]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update comments as suggested by review 16761/head
authorMartin Kronbichler <martin.kronbichler@rub.de>
Wed, 20 Mar 2024 07:27:45 +0000 (08:27 +0100)
committerMartin Kronbichler <martin.kronbichler@rub.de>
Wed, 20 Mar 2024 07:27:45 +0000 (08:27 +0100)
include/deal.II/lac/solver_gmres.h

index 0b7abbf4a9559d7c20aa5a1ede774496b24d901a..e1ef1fd4927b072fa9f72762c77bb3ebb295d35f 100644 (file)
@@ -1838,9 +1838,15 @@ SolverGMRES<VectorType>::solve(const MatrixType         &A,
     {
       VectorType &v = basis_vectors(0, x);
 
+      // Compute the preconditioned/unpreconditioned residual for left/right
+      // preconditioning. If 'x' is the zero vector, then we can bypass the
+      // full computation. But 'x' is only likely to be the zero vector if
+      // that's what the user provided as the starting guess, so it's only
+      // worth checking for this in the first iteration. (Calling all_zero()
+      // costs as much in memory transfer and communication as computing the
+      // norm of a vector.)
       if (left_precondition)
         {
-          // if the vector is zero, bypass the full computation
           if (accumulated_iterations == 0 && x.all_zero())
             preconditioner.vmult(v, b);
           else
@@ -2176,6 +2182,12 @@ SolverFGMRES<VectorType>::solve(const MatrixType         &A,
 
   do
     {
+      // Compute the residual. If 'x' is the zero vector, then we can bypass
+      // the full computation. But 'x' is only likely to be the zero vector if
+      // that's what the user provided as the starting guess, so it's only
+      // worth checking for this in the first iteration. (Calling all_zero()
+      // costs as much in memory transfer and communication as computing the
+      // norm of a vector.)
       if (accumulated_iterations == 0 && x.all_zero())
         v(0, x) = b;
       else

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.