From: Martin Kronbichler Date: Wed, 20 Mar 2024 07:27:45 +0000 (+0100) Subject: Update comments as suggested by review X-Git-Tag: v9.6.0-rc1~460^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab52c2a1eb755d91696ec5527578d4c28c893d89;p=dealii.git Update comments as suggested by review --- diff --git a/include/deal.II/lac/solver_gmres.h b/include/deal.II/lac/solver_gmres.h index 0b7abbf4a9..e1ef1fd492 100644 --- a/include/deal.II/lac/solver_gmres.h +++ b/include/deal.II/lac/solver_gmres.h @@ -1838,9 +1838,15 @@ SolverGMRES::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::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