]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Small improvements in vmult.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 4 May 2009 07:15:21 +0000 (07:15 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 4 May 2009 07:15:21 +0000 (07:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@18806 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_ilu.templates.h

index 01b4a7164d8949631358eeed81ffdd6448ff166a..6a1c62ee68521234425afc920090e9ec22b9d92d 100644 (file)
@@ -200,12 +200,12 @@ void SparseILU<number>::vmult (Vector<somenumber>       &dst,
                                       // right of the diagonal starts
       const unsigned int * const first_after_diagonal = this->prebuilt_lower_bound[row];
 
-      somenumber dst_row = 0;
+      somenumber dst_row = dst(row);
       const number * luval = this->SparseMatrix<number>::val + 
                             (rowstart - column_numbers);
       for (const unsigned int * col=rowstart; col!=first_after_diagonal; ++col, ++luval)
-       dst_row += *luval * dst(*col);
-      dst(row) -= dst_row;
+       dst_row -= *luval * dst(*col);
+      dst(row) = dst_row;
     }
 
                                   // now the backward solve. same
@@ -224,18 +224,16 @@ void SparseILU<number>::vmult (Vector<somenumber>       &dst,
                                       // right of the diagonal starts
       const unsigned int * const first_after_diagonal = this->prebuilt_lower_bound[row];
       
-      somenumber dst_row = 0;
+      somenumber dst_row = dst(row);
       const number * luval = this->SparseMatrix<number>::val + 
                             (first_after_diagonal - column_numbers);
       for (const unsigned int * col=first_after_diagonal; col!=rowend; ++col, ++luval)
-       dst_row += *luval * dst(*col);
-
-      dst(row) -= dst_row;
+       dst_row -= *luval * dst(*col);
 
                                       // scale by the diagonal element.
                                       // note that the diagonal element
                                       // was stored inverted
-      dst(row) *= this->diag_element(row);
+      dst(row) = dst_row * this->diag_element(row);
     }
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.