Generalized minimal residual (GMRES)#
The Generalized Minimal Residual (GMRES) method is a Krylov subspace method for solving general non-Hermitian linear systems \(A \mathbf{x} = \mathbf{b}\). It builds an approximate solution within a Krylov subspace by minimizing the residual norm over that subspace.
Mathematical formulation#
GMRES seeks to solve:
by constructing an approximate solution \(\mathbf{x}_m\) within the Krylov subspace of dimension \(m\) generated by the initial residual \(\mathbf{r}_0 = \mathbf{b} - A\mathbf{x}_0\):
The method finds the vector \(\mathbf{x}_m\) that minimizes the residual norm \(\|\mathbf{b} - A\mathbf{x}_m\|\) over this subspace.
Arnoldi iteration#
An orthonormal basis \(\{\mathbf{v}_1, \ldots, \mathbf{v}_m\}\) for \(\mathcal{K}_m\) is built via the Arnoldi iteration with modified Gram-Schmidt orthogonalization:
Start with \(\mathbf{v}_1 = \mathbf{r}_0 / \|\mathbf{r}_0\|\)
For \(j = 1, \ldots, m\):
Compute \(\mathbf{w} = A \mathbf{v}_j\)
Orthogonalize against previous vectors: \(h_{ij} = \langle \mathbf{v}_i, \mathbf{w} \rangle\)
\(\mathbf{w} \leftarrow \mathbf{w} - \sum_{i=1}^{j} h_{ij} \mathbf{v}_i\)
\(h_{j+1,j} = \|\mathbf{w}\|\)
\(\mathbf{v}_{j+1} = \mathbf{w} / h_{j+1,j}\)
This produces an upper Hessenberg matrix \(H_m\) of size \((m+1) \times m\).
Least squares solution#
Once the basis is built, the residual minimization reduces to a small \((m+1) \times m\) least-squares problem:
which is solved using standard linear algebra routines. The approximate solution is then constructed as:
MPS implementation#
In the MPS formulation, each Arnoldi iteration involves:
One MPO-MPS product (\(A \mathbf{v}_j\))
Multiple MPS scalar products for orthogonalization
Linear combinations of MPS
Simplification steps to control bond dimension growth
Since each iteration increases the bond dimension through MPO-MPS contractions and linear combinations, simplification steps are essential to keep the MPS representation tractable.
Restarted GMRES#
The implementation supports restarted GMRES, where upon reaching the maximum subspace
dimension nvectors, the current approximation \(\mathbf{x}_m\) becomes the
initial guess for a fresh Krylov subspace. This bounds memory usage while still
allowing convergence for difficult problems.
The algorithm detects ill-conditioning in the Krylov basis (when \(h_{j+1,j}\) becomes very small) and can restart early if needed.
When to use GMRES#
GMRES is best suited for:
General non-Hermitian systems: No symmetry requirements on \(A\)
Problems requiring high accuracy: GMRES minimizes the residual optimally over the Krylov subspace
Moderately ill-conditioned systems: The Krylov subspace naturally adapts to the problem structure
Compared to BiCGSTAB:
GMRES guarantees monotonic residual decrease (within each restart cycle)
GMRES requires storing \(m\) basis vectors, while BiCGSTAB uses constant storage
For very large problems, restarted GMRES may converge slower than BiCGSTAB
Example#
import numpy as np
from seemps.state import random_uniform_mps
from seemps.operators import MPO
from seemps.solve import gmres_solve
# Create your operator and right-hand side
n = 10
# ... construct MPO A and MPS b ...
# Solve A @ x = b with restarted GMRES
x, residual = gmres_solve(
A, b,
nvectors=10, # Krylov subspace size
max_restarts=5, # Maximum number of restarts
tolerance=1e-8
)
print(f"Final residual: {residual}")
|
Approximate solution of \(A \psi = b\). |
See also#
Conjugate gradient (CGS) - Conjugate gradient method for Hermitian positive-definite systems
Biconjugate gradient stabilized (BiCGSTAB) - Biconjugate gradient stabilized method
DMRG linear solver - DMRG-based solver with local tensor optimization
Restarted Arnoldi iteration - Arnoldi method for eigenvalue problems (related Krylov technique)