From: kronbichler Date: Tue, 25 Aug 2009 10:58:42 +0000 (+0000) Subject: The first few operations in the CG algorithm can be written in a more compact form. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93710854403bae73863639bebec46e2748893641;p=dealii-svn.git The first few operations in the CG algorithm can be written in a more compact form. git-svn-id: https://svn.dealii.org/trunk@19335 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/solver_cg.h b/deal.II/lac/include/lac/solver_cg.h index fd2b11955a..8833b36b39 100644 --- a/deal.II/lac/include/lac/solver_cg.h +++ b/deal.II/lac/include/lac/solver_cg.h @@ -342,10 +342,10 @@ SolverCG::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::solve (const MATRIX &A, cleanup(); return; } - - g *= -1.; + precondition.vmult(h,g); d.equ(-1.,h);