Arnoldi reduces this minimization to a small least-squares problem. Restarting changes the sequence of search spaces and is a distinct concrete variant.
Theorem (Minimum residual). For any square \mathbf{A}, right-hand side \mathbf{b}, starting point \mathbf{x}_0, and k\ge0, the mathematical GMRES iterate satisfies
\|\mathbf{b}-\mathbf{A}\mathbf{x}_k\|_2\le\|\mathbf{b}-\mathbf{A}\mathbf{y}\|_2\quad\text{for every }\mathbf{y}\in\mathbf{x}_0+\mathcal{K}_k(\mathbf{A},\mathbf{r}_0),
where \mathbf{r}_0=\mathbf{b}-\mathbf{A}\mathbf{x}_0. No positive-definiteness assumption is required for this optimality statement.
Lean statement and details
NLAlib.isMinOn_gmresIterate.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n]
[DecidableEq n] (A : Matrix n n 𝕜) (b x₀ : n → 𝕜) (q : ℕ) :
IsMinOn (fun y ↦ ‖WithLp.toLp 2 (b - A *ᵥ y)‖)
(↑(AffineSubspace.mk' x₀ (krylovSpace A (b - A *ᵥ x₀) q))) (gmresIterate A b x₀ q)
, for every \mathbf{A} and q: with \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0, the canonical bases \mathbf{Q}_j = \mathsf{arnoldiMatrix}(\mathbf{A}, \mathbf{r}_0, j) and \underline{\mathbf{H}}_q = \mathbf{Q}_{q+1}^{\mathsf{H}}\mathbf{A}\mathbf{Q}_q, \mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q) = \mathbf{x}_0 + \|\mathbf{r}_0\|\,\mathbf{Q}_q\underline{\mathbf{H}}_q^{+}\mathbf{e}_0, with no grade hypothesis. [SaadSchultz1986, §3.1]; [Saad2003, §6.5.1]. It is (8) there, and (6.29)–(6.30) in Saad's book, with the least-squares minimiser of \|\|\mathbf{r}_0\|\mathbf{e}_0 - \underline{\mathbf{H}}_q\mathbf{y}\| in place of the pseudoinverse, for q up to the breakdown step.
Lean statement and details
NLAlib.gmresIterate_eq_arnoldiMatrix.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n]
[DecidableEq n] (A : Matrix n n 𝕜) (b x₀ : n → 𝕜) (q : ℕ) :
gmresIterate A b x₀ q =
x₀ +
↑‖WithLp.toLp 2 (b - A *ᵥ x₀)‖ •
arnoldiMatrix A (b - A *ᵥ x₀) q *ᵥ
pinv ((arnoldiMatrix A (b - A *ᵥ x₀) (q + 1))ᴴ * A * arnoldiMatrix A (b - A *ᵥ x₀) q) *ᵥ
Pi.single 0 1
Theorem (The GMRES bound for diagonalisable \mathbf{A}).
if \mathbf{A}\mathbf{V} = \mathbf{V}\operatorname{diag}(\mathbf{d}) with \mathbf{V} invertible and p \in \Bbbk[X], \deg p \le q, p(0) = 1, satisfies \lvert p(d_i) \rvert \le \eta for every eigenvalue, then \|\mathbf{b} - \mathbf{A}\,\mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q)\| \le \kappa(\mathbf{V})\,\eta\,\|\mathbf{r}_0\| \,. The hypothesis is the body of IsDiagonalizable with its witness (\mathbf{V} invertible, as IsUnit V; Matrix.isUnit_iff_isUnit_det converts from IsDiagonalizable's determinant form). [SaadSchultz1986, Proposition 4]; [TrefethenBau1997, Theorem 35.2]; locators to verify.
Lean statement and details
NLAlib.norm_sub_mulVec_gmresIterate_le_pseudoConditionNumber_mul.{u_1, u_2} {𝕜 : Type u_1}
[RCLike 𝕜] {n : Type u_2} [Fintype n] [DecidableEq n] {A V : Matrix n n 𝕜} {d : n → 𝕜}
(hV : IsUnit V) (hAV : A * V = V * diagonal d) (b x₀ : n → 𝕜) {q : ℕ} {p : Polynomial 𝕜}
(hp : p.degree ≤ ↑q) (hp₀ : Polynomial.eval 0 p = 1) {η : ℝ}
(hη : ∀ (i : n), ‖Polynomial.eval (d i) p‖ ≤ η) :
‖WithLp.toLp 2 (b - A *ᵥ gmresIterate A b x₀ q)‖ ≤
pseudoConditionNumber V * η * ‖WithLp.toLp 2 (b - A *ᵥ x₀)‖
(Elman): if the Hermitian part of \mathbf{A} has spectrum in [a, \infty), 0 < a, and \|\mathbf{A}\|_2 \le a', then \|\mathbf{b} - \mathbf{A}\,\mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q)\| \le \Bigl(1 - \frac{a^2}{a'^2}\Bigr)^{q/2}\|\mathbf{r}_0\| \,. The residual polynomial is (1 - \alpha x)^q with \alpha = a/a'^2. [EisenstatElmanSchultz1983, Theorem 3.3]; [Saad2003, Theorem 6.30]; locators to verify.
Lean statement and details
NLAlib.norm_sub_mulVec_gmresIterate_le_sqrt_one_sub_sq_pow.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} {a a' : ℝ} (ha : 0 < a)
(hs : spectrum ℝ (hermitianPart A) ⊆ Set.Ici a) (hA : specNorm A ≤ a') (b x₀ : n → 𝕜) (q : ℕ) :
‖WithLp.toLp 2 (b - A *ᵥ gmresIterate A b x₀ q)‖ ≤
√(1 - (a / a') ^ 2) ^ q * ‖WithLp.toLp 2 (b - A *ᵥ x₀)‖
for invertible \mathbf{A} and \mathbf{A}\mathbf{x}_\star = \mathbf{b}, GMRES reaches the solution once q is at least the grade of \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0: \mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q) = \mathbf{x}_\star. [SaadSchultz1986, Proposition 2]; [Saad2003, Proposition 6.10]. Both state that the iterate at the breakdown step, which is the grade ([Saad2003, Proposition 6.6]), is exact.
Lean statement and details
NLAlib.gmresIterate_eq_of_krylovGrade_le.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2}
[Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : IsUnit A) {b xs : n → 𝕜} (hxs : A *ᵥ xs = b)
(x₀ : n → 𝕜) {q : ℕ} (h : krylovGrade A (b - A *ᵥ x₀) ≤ q) : gmresIterate A b x₀ q = xs
, the standard implementation: with \underline{\mathbf{H}}_q computed by the Arnoldi process, \mathbf{R} the leading q \times q block of its Givens factor and \mathbf{g} the first q entries of the rotated \mathbf{e}_0, for invertible \mathbf{A} and every q, \mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q) = \mathbf{x}_0 + \|\mathbf{r}_0\|\,\mathbf{Q}_q\,\mathsf{backSubst}(\mathbf{R}, \mathbf{g}), with no hypothesis on the grade or on the computed pivots. [SaadSchultz1986, §3.2]; [Saad2003, Proposition 6.9]. Both solve the small least-squares problem by plane rotations and back substitution on the triangular system left after deleting the last row; the rotation signs here follow NLAlib.givens.
Lean statement and details
NLAlib.gmresIterate_eq_backSubst_givensHessenberg.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : IsUnit A) (b x₀ : n → 𝕜)
(q : ℕ) :
gmresIterate A b x₀ q =
x₀ +
↑‖WithLp.toLp 2 (b - A *ᵥ x₀)‖ •
mgsArnoldiMatrix A (b - A *ᵥ x₀) q *ᵥ
backSubst
((givensHessenbergR (mgsArnoldiHessenberg A (b - A *ᵥ x₀) q)).submatrix Fin.castSucc id)
fun i ↦
((givensHessenbergQ (mgsArnoldiHessenberg A (b - A *ᵥ x₀) q))ᴴ *ᵥ Pi.single 0 1)
i.castSucc
Theorem (The Petrov–Galerkin condition characterises GMRES).
for invertible \mathbf{A}: with \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0, a vector \mathbf{y} of \mathbf{x}_0 + \mathcal{K}_q(\mathbf{A}, \mathbf{r}_0) with (\mathbf{A}\mathbf{K}_q(\mathbf{A}, \mathbf{r}_0))^{\mathsf{H}}(\mathbf{b} - \mathbf{A}\mathbf{y}) = \mathbf{0}, a residual orthogonal to \mathbf{A}\mathcal{K}_q(\mathbf{A}, \mathbf{r}_0), is \mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q). The parallel of Matrix.PosDef.eq_cgIterate_of_conjTranspose_krylovMatrix_mulVec_sub_eq_zero. [Saad2003, Proposition 5.3]; [Saad2003, §6.5]. Saad shows, for any square matrix, that this condition is equivalent to minimising the residual over \mathbf{x}_0 + \mathcal{K}, and GMRES is the method with \mathcal{K} = \mathcal{K}_q; invertibility makes the minimiser unique.
Lean statement and details
NLAlib.eq_gmresIterate_of_conjTranspose_mul_krylovMatrix_mulVec_sub_eq_zero.{u_1, u_2}
{𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜}
(hA : IsUnit A) {b x₀ y : n → 𝕜} {q : ℕ} (hy : y - x₀ ∈ krylovSpace A (b - A *ᵥ x₀) q)
(h : (A * krylovMatrix A (b - A *ᵥ x₀) q)ᴴ *ᵥ (b - A *ᵥ y) = 0) : y = gmresIterate A b x₀ q
for every \mathbf{A} and p \in \Bbbk[X] with \deg p \le q, p(0) = 1, \|\mathbf{b} - \mathbf{A}\,\mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q)\| \le \|p(\mathbf{A})\mathbf{r}_0\|. [Saad2003, §6.11.4].
Lean statement and details
NLAlib.norm_sub_mulVec_gmresIterate_le_norm_aeval_mulVec.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} [Fintype n] [DecidableEq n] (A : Matrix n n 𝕜) (b x₀ : n → 𝕜) {q : ℕ}
{p : Polynomial 𝕜} (hp : p.degree ≤ ↑q) (hp₀ : Polynomial.eval 0 p = 1) :
‖WithLp.toLp 2 (b - A *ᵥ gmresIterate A b x₀ q)‖ ≤
‖WithLp.toLp 2 ((Polynomial.aeval A) p *ᵥ (b - A *ᵥ x₀))‖
for invertible \mathbf{A} and every q, with \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0, \underline{\mathbf{H}}_q computed by the Arnoldi process and \mathbf{G} its Givens factor, \|\mathbf{b} - \mathbf{A}\,\mathsf{gmresIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q)\| = \|\mathbf{r}_0\|\,\lvert(\mathbf{G}^{\mathsf{H}}\mathbf{e}_0)_q\rvert, the modulus of the last entry of the rotated \mathbf{e}_0, available without forming the iterate. [SaadSchultz1986, Proposition 1]; [Saad2003, Proposition 6.9]. It is (6.42) in Saad's book.
Lean statement and details
NLAlib.norm_sub_mulVec_gmresIterate_eq_norm_givensHessenbergQ.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : IsUnit A) (b x₀ : n → 𝕜)
(q : ℕ) :
‖WithLp.toLp 2 (b - A *ᵥ gmresIterate A b x₀ q)‖ =
‖WithLp.toLp 2 (b - A *ᵥ x₀)‖ *
‖((givensHessenbergQ (mgsArnoldiHessenberg A (b - A *ᵥ x₀) q))ᴴ *ᵥ Pi.single 0 1)
(Fin.last q)‖