]> https://gitweb.dealii.org/ - dealii.git/commitdiff
The method Jacobi_step now uses vmult and other pre-defined functions instead of...
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 25 Aug 2009 11:00:37 +0000 (11:00 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 25 Aug 2009 11:00:37 +0000 (11:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@19336 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 439aee252fb2097f8b2c1966bf9f75a2d061a66e..374f9173eeff2d0e66c75dafd511a12d2d78a891 100644 (file)
@@ -1580,18 +1580,16 @@ SparseMatrix<number>::Jacobi_step (Vector<somenumber> &v,
   GrowingVectorMemory<Vector<somenumber> > mem;
   typename VectorMemory<Vector<somenumber> >::Pointer w(mem);
   w->reinit(v);
-  
-  for (unsigned int row=0; row<m(); ++row)
+
+  if (!v.all_zero())
     {
-      somenumber s = b(row);
-      for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j)
-       {
-         s -= val[j] * v(cols->colnums[j]);
-       }
-      (*w)(row) = v(row) + s * om / val[cols->rowstart[row]];
+      vmult (*w, v);
+      *w -= b;
     }
-  for (unsigned int row=0; row<m(); ++row)
-    v(row) = (*w)(row);
+  else
+    w->equ (-1.,b);
+  precondition_Jacobi (*w, *w, om);
+  v -= *w;
 }
 
 

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.