From: Martin 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-Tag: v8.0.0~7233 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5194aca79190b2a9b8b6912df79d51f90c38de3;p=dealii.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);