Theorem (Matrix.PosDef.cgIterate_eq). CG is \mathbf{x}_0 + \mathbf{Q}(\mathbf{Q}^{\mathsf{H}}\mathbf{A}\mathbf{Q})^{-1}\mathbf{Q}^{\mathsf{H}}\mathbf{r}_0 for any orthonormal basis \mathbf{Q} of the Krylov space, for positive definite \mathbf{A}: \mathsf{cgIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q) = \mathbf{x}_0 + \mathbf{Q}(\mathbf{Q}^{\mathsf{H}}\mathbf{A}\mathbf{Q})^{-1}\mathbf{Q}^{\mathsf{H}}\mathbf{r}_0, \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0. [Saad2003, §6.7].
Headline
Lean statement and details
Matrix.PosDef.cgIterate_eq.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} {r : Type u_3}
[Fintype n] [DecidableEq n] [Fintype r] [DecidableEq r] {A : Matrix n n 𝕜} (hA : A.PosDef)
{Q : Matrix n r 𝕜} (hQ : HasOrthonormalCols Q) {b x₀ : n → 𝕜} {q : ℕ}
(hK : Q.mulVecLin.range = krylovSpace A (b - A *ᵥ x₀) q) :
cgIterate A b x₀ q = x₀ + Q *ᵥ (Qᴴ * A * Q)⁻¹ *ᵥ Qᴴ *ᵥ (b - A *ᵥ x₀)