]> https://gitweb.dealii.org/ - dealii.git/commitdiff
The first few operations in the CG algorithm can be written in a more compact form.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 25 Aug 2009 10:58:42 +0000 (10:58 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 25 Aug 2009 10:58:42 +0000 (10:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@19335 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/solver_cg.h

index fd2b11955a97142874f401d034575677b0782f5d..8833b36b39c5e331af99d05747d695ed823109b5 100644 (file)
@@ -342,10 +342,10 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
     if (!x.all_zero())
       {
        A.vmult(g,x);
-       g.sadd(-1.,1.,b);
+       g.add(-1.,b);
       }
     else
-      g = b;
+      g.equ(-1.,b);
     res = g.l2_norm();
     
     conv = this->control().check(0,res);
@@ -354,8 +354,7 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
        cleanup();
        return;
       }
-    
-    g *= -1.;
+
     precondition.vmult(h,g);
     
     d.equ(-1.,h);

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.