Theorem (Matrix.IsHermitian.cgIterate_eq_lanczosMatrix).The Lanczos recurrence yields CG: for Hermitian \mathbf{A} and every q, \mathsf{cgIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q + 1) = \mathbf{x}_0 + \|\mathbf{r}_0\|\,\mathbf{Q}\mathbf{T}^{+}\mathbf{e}_0 with \mathbf{Q} and \mathbf{T} computed by q + 1 steps of the recurrence from \mathbf{r}_0; past the grade the recurrence has frozen at zero and the iterate is unchanged. [Saad2003, §6.7.1].
Headline (provisional)
Lean statement and details
Matrix.IsHermitian.cgIterate_eq_lanczosMatrix.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2}
[Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : A.IsHermitian) (b x₀ : n → 𝕜) (q : ℕ) :
cgIterate A b x₀ (q + 1) =
x₀ +
↑‖WithLp.toLp 2 (b - A *ᵥ x₀)‖ •
lanczosMatrix A (b - A *ᵥ x₀) (q + 1) *ᵥ
pinv (lanczosTridiagonal A (b - A *ᵥ x₀) (q + 1)) *ᵥ Pi.single 0 1
Theorem (cgIterate_eq_arnoldiMatrix).The Lanczos basis yields CG, for every \mathbf{A} and every q, with no grade hypothesis: with \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0, the canonical basis \mathbf{Q} = \mathsf{arnoldiMatrix}(\mathbf{A}, \mathbf{r}_0, q + 1) of \mathcal{K}_{q+1}(\mathbf{A}, \mathbf{r}_0) and \mathbf{T} = \mathbf{Q}^{\mathsf{H}}\mathbf{A}\mathbf{Q}, \mathsf{cgIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q + 1) = \mathbf{x}_0 + \|\mathbf{r}_0\|\,\mathbf{Q}\mathbf{T}^{+}\mathbf{e}_0. For positive definite \mathbf{A} and q + 1 \le \nu, \mathbf{T}^{+} = \mathbf{T}^{-1} (pinv_of_isUnit). [Saad2003, §6.7.1].
Lean statement and details
NLAlib.cgIterate_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 : ℕ) :
cgIterate A b x₀ (q + 1) =
x₀ +
↑‖WithLp.toLp 2 (b - A *ᵥ x₀)‖ •
arnoldiMatrix A (b - A *ᵥ x₀) (q + 1) *ᵥ
pinv
((arnoldiMatrix A (b - A *ᵥ x₀) (q + 1))ᴴ * A *
arnoldiMatrix A (b - A *ᵥ x₀) (q + 1)) *ᵥ
Pi.single 0 1