NLAlib.cgIterate
Library · def
The conjugate gradient iterate after q steps from the start \mathbf{x}_0, with \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0: \mathsf{cgIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q) := \mathbf{x}_0 + \mathsf{galerkinInverse}(\mathbf{A}, \mathbf{K}_q(\mathbf{A}, \mathbf{r}_0))\,\mathbf{r}_0, which is \mathbf{x}_0 + \mathbf{Q}(\mathbf{Q}^{\mathsf{H}}\mathbf{A}\mathbf{Q})^{-1}\mathbf{Q}^{\mathsf{H}}\mathbf{r}_0 for every orthonormal basis \mathbf{Q} of \mathcal{K}_q(\mathbf{A}, \mathbf{r}_0) when \mathbf{A} is positive definite (Matrix.PosDef.cgIterate_eq). The zero start is \mathbf{x}_0 = \mathbf{0}. Basis-free, total, not an algorithm; the Hestenes–Stiefel recurrence computes it (Matrix.PosDef.cgState_x_eq). Junk value: when the compression of \mathbf{A} to the Krylov space is singular, the pseudoinverse formula of galerkinInverse. [HestenesStiefel1952, Theorem 6:1]; [Saad2003, §6.7]. Hestenes and Stiefel define the iterate by the recurrence (3:1) and show in Theorem 6:1 that it minimises the error function (\mathbf{x}_\star - \mathbf{x})^{\mathsf{H}}\mathbf{A}(\mathbf{x}_\star - \mathbf{x}) on the plane through \mathbf{x}_0, \dots, \mathbf{x}_q; Saad defines it as the orthogonal projection onto the Krylov space, which is this definition. Algorithm: cg (specification)
NLAlib.cgIterate.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n] [DecidableEq n]
(A : Matrix n n 𝕜) (b x₀ : n → 𝕜) (q : ℕ) : n → 𝕜Import NLAlib.Krylov.LinearSystems.CG.