- Introduced by
- Youcef Saad and Martin H. Schultz
- Year
- 1986
- Type
- Iterative linear solver for non-symmetric systems
- Family
- Krylov Subspace Iterative
What does it do?
GMRES (Generalized Minimal Residual) is an iterative method for solving large sparse linear systems Ax = b in which A may be non-symmetric.
Saad and Schultz introduced it in 1986. At each step it builds an orthonormal Krylov basis with Arnoldi's process and chooses the approximate solution that minimises the residual norm over the current Krylov subspace.
The intuition behind the method
GMRES constructs an orthonormal basis of the Krylov subspace, the space spanned by the starting residual and its successive images under A. At each step it selects the combination of basis vectors that minimises the residual norm over that subspace. Because the subspace grows at every step, the residual norm cannot increase within a cycle. Storing and orthogonalising the basis becomes more expensive as the cycle lengthens, which is why GMRES is usually run in restarted form.
History
Saad and Schultz introduced GMRES in 1986 (Saad and Schultz, 1986). The method is described there as a generalisation of Paige and Saunders' MINRES to non-symmetric systems and as theoretically equivalent to the generalised conjugate residual method and ORTHODIR. Walker (1988) gave a Householder-based implementation that is more stable than the standard Gram–Schmidt version. The restarted variant GMRES(m) is discussed in standard references such as Saad (2003), which covers Krylov subspace methods in depth.
When to use it
Choose GMRES when the matrix is non-symmetric or indefinite, so that CG (which requires a symmetric positive definite matrix) does not apply. It is commonly used for advection-dominated or coupled problems, where the discretised operator is non-symmetric. The restart length m trades memory against convergence: storage grows with m, while a short cycle limits memory at the cost of slower convergence. A moderate value (a few tens) is a common starting point, to be tuned for the problem. For symmetric matrices, CG or MINRES are generally more efficient. GMRES is also a poor first choice when memory is tight and the convergence behaviour is unknown. Reading the result: the residual that GMRES minimises depends on the preconditioning. With right preconditioning it is the residual of the original system, b − Ax. With left preconditioning it is the residual of the preconditioned system, M⁻¹(b − Ax), which can differ noticeably from the true residual. Convergence is usually tested with a relative tolerance such as ‖r_k‖/‖r₀‖ or ‖r_k‖/‖b‖; check which definition your implementation uses. A residual that stays flat across several restart cycles indicates stagnation. Before concluding anything, check the restart length, the preconditioner and the tolerance.
Limitations and considerations
- Full GMRES stores all Krylov vectors; with restart length m, storage scales as O(m·n), which becomes expensive for large m.
- The orthogonalisation work in iteration k grows with the number of stored vectors, so the cost per iteration rises as the cycle lengthens; restarting limits this growth but removes the minimisation over the full space.
- Without preconditioning, convergence is often slow for ill-conditioned problems.
- Gram–Schmidt orthogonalisation can lose orthogonality and introduce numerical error. Walker (1988) reports that Householder-based orthogonalisation is more stable, particularly as the limits of residual reduction are approached, at the cost of extra arithmetic.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Makes no symmetry or positivity assumption on A, so it applies to general non-symmetric and complex matrices.
- Within each cycle the residual norm cannot increase, because each Arnoldi step enlarges the subspace over which the residual is minimised (the minimisation property stated in Saad and Schultz, 1986).
- Accepts left or right preconditioning; flexible GMRES (FGMRES) allows the preconditioner to change between iterations.
- In exact arithmetic, full GMRES terminates once the Krylov subspace is exhausted, so it always yields an exact solution, although that may be too costly to reach in practice.
Applications
- Computational fluid dynamics: large sparse linear systems from discretised flow equations, including coupled velocity–pressure systems (a typical example of use).
- Structural analysis: sparse linear systems from finite element discretisations (a typical example of use).
- Electromagnetics: sparse linear systems from discretised field equations (a typical example of use).
- Geophysics: large linear systems in subsurface imaging and inversion (a typical example of use).
How it works
How it works
Compute the initial residual r₀ = b − Ax₀, normalise v₁ = r₀/‖r₀‖, choose the restart length m, and initialise the Hessenberg matrix H.
Formula
r_0 = b - A x_0,\quad \beta = \|r_0\|_2,\quad v_1 = r_0/\beta
Perform one Arnoldi step: compute w = A v_k, orthogonalise w against v₁, …, v_k, normalise the result to obtain v_{k+1}, and store the orthogonalisation coefficients in column k of H.
Formula
A V_m = V_{m+1} \bar H_mSolve the small least-squares problem minimise ‖β e₁ − H y‖₂ for y, where β = ‖r₀‖, and form the approximate solution x_m = x₀ + V_m y with V_m = [v₁ … v_m].
Formula
y_m = \arg\min_{y} \left\| \beta e_1 - \bar H_m y \right\|_2Check convergence against the tolerance. If the residual is not small enough and the cycle is complete, restart from x_m as the new initial guess; otherwise continue the Arnoldi steps.
Formula
x_m = x_0 + V_m y_m,\quad \|r_m\|_2 = \left\| \beta e_1 - \bar H_m y_m \right\|_2
Common pitfalls
- Choosing a restart length m that is too small can make convergence very slow or cause stagnation, while a very large m increases memory and orthogonalisation cost. The suitable range is problem-dependent.
- Neglecting preconditioning and expecting reasonable convergence on poorly conditioned systems.
- Reading a flat residual over several restart cycles as proof of a bug, or conversely as an unavoidable property of the method. GMRES(m) can stagnate because each restart discards the accumulated subspace, but a plateau can also come from a poor preconditioner, an unsuitable restart length or an implementation error, so check these before attributing the cause.
- Using a preconditioner that changes between iterations with standard right-preconditioned GMRES, which assumes a fixed preconditioner; flexible GMRES (FGMRES) is designed for this case.
Frequently asked questions
What is the Krylov subspace and why does Arnoldi orthogonalization matter?
The Krylov subspace K_k(A, r₀) = span{r₀, A r₀, A² r₀, …, A^{k-1} r₀} contains successively richer information about A. Arnoldi orthogonalization produces an orthonormal basis for this space, which allows the residual to be minimised by solving a small least-squares problem in a numerically stable way.
Why restart at all if full GMRES converges?
Full GMRES must store every Krylov vector and orthogonalise each new vector against all earlier ones, so storage and work grow with the iteration count. For large systems the full method may exceed the available memory. Restarting discards the stored basis and begins again from the current iterate, trading some convergence speed for feasibility.
What restart parameter m should I choose?
There is no universal value; it depends on the problem. A moderate value (a few tens) is a common starting point. Increase m if memory allows and convergence is slow or stagnates, and decrease it if memory is tight. Compare a few values on a representative problem, together with the preconditioner, before settling on one.
How does left preconditioning differ from right preconditioning in GMRES?
Left preconditioning solves M⁻¹Ax = M⁻¹b, so GMRES minimises the residual of the preconditioned system, which may change the convergence rate depending on M. Right preconditioning solves AM⁻¹y = b and then recovers x = M⁻¹y; the residual minimised is that of the original system b − Ax, which is why right preconditioning is often preferred for monitoring. FGMRES allows the right preconditioner to vary from iteration to iteration.
Related methods
Sources
Saad, Y., & Schultz, M. H. (1986). GMRES: A generalized minimal residual algorithm for solving nonsymmetric linear systems. SIAM Journal on Scientific and Statistical Computing, 7(3), 856–869.
Open DOI referenceWalker, H. F. (1988). Implementation of the GMRES method using Householder reflections. SIAM Journal on Scientific and Statistical Computing, 9(1), 152–163.
Open DOI referenceSaad, Y. (2003). Iterative Methods for Sparse Linear Systems (2nd ed.). SIAM.
Open DOI reference