From de0e014ad9f6ffe71ce30c4c6224f81319da87b2 Mon Sep 17 00:00:00 2001
From: Markus Blatt <mblatt@dune-project.org>
Date: Tue, 4 Oct 2011 18:27:06 +0000
Subject: [PATCH] Use the initial defect in the stopping criteria of GMRES (not
 the defect of the already preconditioned rhs).

[[Imported from SVN: r1502]]
---
 dune/istl/solvers.hh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/dune/istl/solvers.hh b/dune/istl/solvers.hh
index 8c8981594..3c10864ed 100644
--- a/dune/istl/solvers.hh
+++ b/dune/istl/solvers.hh
@@ -1241,9 +1241,7 @@ namespace Dune {
 
       // clear solver statistics
       res.clear();
-
       _M.pre(x,b);
-
       if (_recalc_defect)
       {
         // norm_0 = norm(M^-1 b)
@@ -1259,9 +1257,9 @@ namespace Dune {
       {
         // norm_0 = norm(M^-1 b)
         w = 0.0; _M.apply(w,b); // w = M^-1 b
-        norm_0 = _sp.norm(w);
         // r = _M.solve(b - A * x);
         _A_.applyscaleadd(-1,x, /* => */ b); // b = b - Ax;
+        norm_0 = _sp.norm(b);
         v[0] = 0.0; _M.apply(v[0],b); // r = M^-1 b
         beta = _sp.norm(v[0]);
       }
@@ -1269,7 +1267,6 @@ namespace Dune {
       // avoid division by zero
       if (norm_0 == 0.0)
         norm_0 = 1.0;
-
       norm = norm_old = _sp.norm(v[0]);
 
       // print header
@@ -1280,7 +1277,7 @@ namespace Dune {
         {
           this->printHeader(std::cout);
           this->printOutput(std::cout,0,norm_0);
-          this->printOutput(std::cout,0,norm);
+          this->printOutput(std::cout,0,norm, norm_0);
         }
       }
 
-- 
GitLab