Let \mathbf{A} be symmetric positive definite, let \mathbf{A}\mathbf{x}_\star=\mathbf{b}, and write \mathbf{x}_k for the mathematical CG iterate from \mathbf{x}_0. The energy norm is \|\mathbf{v}\|_\mathbf{A}^2=\mathbf{v}^{\mathsf{T}}\mathbf{A}\mathbf{v}.
Theorem (Energy optimality). The mathematical CG iterate minimizes the energy error over the initial guess plus its Krylov space:
\mathbf{x}_k\in\operatorname*{arg\,min}_{\mathbf{y}\in\mathbf{x}_0+\mathcal{K}_k(\mathbf{A},\mathbf{r}_0)}\|\mathbf{x}_\star-\mathbf{y}\|_\mathbf{A}^2.
Here \mathcal{K}_k(\mathbf{A},\mathbf{r}_0)=\operatorname{span}\{\mathbf{r}_0,\mathbf{A}\mathbf{r}_0,\ldots,\mathbf{A}^{k-1}\mathbf{r}_0\}. The energy error cannot increase as the search space grows.
Lean statement and details
Matrix.PosDef.isMinOn_cgIterate.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n]
[DecidableEq n] {A : Matrix n n 𝕜} (hA : A.PosDef) {b xs : n → 𝕜} (hxs : A *ᵥ xs = b) (x₀ : n → 𝕜)
(q : ℕ) :
IsMinOn (fun y ↦ RCLike.re (quadForm A (xs - y)))
(↑(AffineSubspace.mk' x₀ (krylovSpace A (b - A *ᵥ x₀) q))) (cgIterate A b x₀ q)
Full source on GitHub
Copy link
Theorem (Chebyshev convergence). If the eigenvalues of \mathbf{A} lie in [a,a^{\prime}], a>0, then
\|\mathbf{x}_\star-\mathbf{x}_k\|_\mathbf{A}^2\le4\left(\frac{\sqrt\kappa-1}{\sqrt\kappa+1}\right)^{2k}\|\mathbf{x}_\star-\mathbf{x}_0\|_\mathbf{A}^2,\qquad\kappa=\frac{a^{\prime}}a.
The positive spectral interval controls the rate. The implementation pages connect this mathematical result to stored solver outputs.
Lean statement and details
Matrix.IsHermitian.re_quadForm_sub_cgIterate_le_four_mul_pow.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : A.IsHermitian) {a a' : ℝ}
(ha : 0 < a) (hs : spectrum ℝ A ⊆ Set.Icc a a') {b xs : n → 𝕜} (hxs : A *ᵥ xs = b) (x₀ : n → 𝕜)
(q : ℕ) :
RCLike.re (quadForm A (xs - cgIterate A b x₀ q)) ≤
4 * ((√(a' / a) - 1) / (√(a' / a) + 1)) ^ (2 * q) * RCLike.re (quadForm A (xs - x₀))
Full source on GitHub
Copy link
Theorem (Polynomial error bound). For every polynomial p of degree at most k with p(0)=1,
\|\mathbf{x}_\star-\mathbf{x}_k\|_\mathbf{A}^2\le\|p(\mathbf{A})(\mathbf{x}_\star-\mathbf{x}_0)\|_\mathbf{A}^2.
A polynomial small on the spectrum therefore yields a small CG error.
Lean statement and details
Matrix.PosDef.re_quadForm_sub_cgIterate_le.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2}
[Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : A.PosDef) {s : Set ℝ} (hs : spectrum ℝ A ⊆ s)
{b xs : n → 𝕜} (hxs : A *ᵥ xs = b) (x₀ : n → 𝕜) {q : ℕ} {p : Polynomial ℝ} (hp : p.degree ≤ ↑q)
(hp₀ : Polynomial.eval 0 p = 1) {η : ℝ} (hη : ∀ x ∈ s, |Polynomial.eval x p| ≤ η) :
RCLike.re (quadForm A (xs - cgIterate A b x₀ q)) ≤ η ^ 2 * RCLike.re (quadForm A (xs - x₀))
Full source on GitHub
Copy link
Theorem (Finite termination). Let g be the dimension of the Krylov space generated by the initial residual. Once k\ge g, the mathematical iterate satisfies \mathbf{x}_k=\mathbf{x}_\star. In dimension n, at most n exact-arithmetic steps suffice.
Lean statement and details
Matrix.PosDef.cgIterate_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 : A.PosDef) {b xs : n → 𝕜} (hxs : A *ᵥ xs = b)
(x₀ : n → 𝕜) {q : ℕ} (h : krylovGrade A (b - A *ᵥ x₀) ≤ q) : cgIterate A b x₀ q = xs
Full source on GitHub
Copy link