Skip to content

qmr

sparse · scripts/sparse/qmr.m

: x = qmr (A, b, rtol, maxit, M1, M2, x0)
: x = qmr (A, b, rtol, maxit, P)
: [x, flag, relres, iter, resvec] = qmr (A, b, …)

Solve A x = b with the quasi-minimal residual method of Freund and Nachtigal, in its basic form without look-ahead.

Optional inputs, each of which may be left out or passed as [] to take its default:

  • rtol: relative residual tolerance, default 1e-6.
  • maxit: iteration limit, default min (20, numel (b)).
  • x0: starting vector, default all zeros.

The method needs products with both A and its transpose, so when A is given as a function it is called with two arguments: f (x, "notransp") must return A * x and f (x, "transp") must return A' * x.

A preconditioner P may be supplied as two factors M1 and M2 with P = M1 * M2, or as a single matrix P in the place of M1. A factor given as a function follows the same two-argument convention and must return M \ x for "notransp" and M' \ x for "transp".

Outputs beyond x:

  • flag: 0 when the tolerance was met, 1 when the iteration limit was reached first, 3 when the iterates stopped changing. The value 2 is never produced; it is reserved so that the numbering matches the other iterative solvers.
  • relres: the relative residual of the returned x.
  • iter: the number of iterations taken.
  • resvec: the residual norm after each iteration.

References: R. W. Freund and N. M. Nachtigal, "QMR: a quasi-minimal residual method for non-Hermitian linear systems", Numer. Math. 60 (1991); and the iterative-methods templates book by Barrett, Berry, Chan, Demmel, Donato, Dongarra, Eijkhout, Pozo, Romine and van der Vorst, SIAM, 2nd ed., 1994.