0
$\begingroup$

I'm trying to diagnose what I assume is a bug in a code that uses the GMRES method to solve a system of linear equations. At each GMRES iteration the norm of the residual is printed. When GMRES converges the norm of the residual is computed manually. Usually these two norms agree with each other, but now they do not. The actual norm of the residual is many orders of magnitude larger than the one computed iteratively with GMRES.

The third edition of Matrix Computations by Golub and Van Loan (algorithm 10.4.4) says how the GMRES algorithm computes this norm, $h_{k+1,k}$, iteratively. It also says it is easy to verify that \begin{equation} \left\Vert b-Ax_{k}\right\Vert =h_{k+1,k} \end{equation}

From past experience I know that these two norms can disagree when GMRES is attempting to solve a nonlinear system (I.e. the matrix $A$ depends on $x$). Since GMRES can be implemented as a matrix-free algorithm, this mistake is easier to make than one may expect. I've checked my code for this type of mistake and cannot find any.

What other circumstances can cause these two norms, which agree analytically, to disagree numerically?

$\endgroup$
3
  • 1
    $\begingroup$ What's the condition number of the matrix? $\endgroup$
    – user3417
    Jun 6, 2018 at 20:16
  • $\begingroup$ @Metahominid I think the problem with my code was the matrix was ill-conditioned. I was enforcing a physical boundary condition that contradicts the other physics in the PDE I'm solving. Once I changed the boundary condition the two norms agreed, and I was able to get a sensible solution. $\endgroup$
    – Andrew
    Jun 6, 2018 at 22:03
  • $\begingroup$ that sounds reasonable $\endgroup$
    – user3417
    Jun 6, 2018 at 22:08

1 Answer 1

0
$\begingroup$

I am facing a similar issue with the GMRES residual not exactly matching with the actual residual I manually compute every iteration. Is it expected that the GMRES residual at every iteration match with the actual manually computed residual?

$\endgroup$
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .