From: wolf Date: Sun, 25 Apr 1999 22:14:27 +0000 (+0000) Subject: Check for starting vector being a solution already. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=125923b7effd4a6b9bab5540ed5ad68784977f5a;p=dealii-svn.git Check for starting vector being a solution already. git-svn-id: https://svn.dealii.org/trunk@1203 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/solver_gmres.h b/deal.II/lac/include/lac/solver_gmres.h index 450b7ad2e5..5db3b45de1 100644 --- a/deal.II/lac/include/lac/solver_gmres.h +++ b/deal.II/lac/include/lac/solver_gmres.h @@ -225,6 +225,19 @@ SolverGMRES::solve (const Matrix& A, }; double rho = v.l2_norm(); + + // check the residual here as + // well since it may be that + // we got the exact (or an almost + // exact) solution vector at + // the outset. if we wouldn't + // check here, the next scaling + // operation would produce + // garbage + iteration_state = control().check (accumulated_iterations, rho); + if (iteration_state != SolverControl::iterate) + break; + gamma(0) = rho; v.scale (1./rho);