NLA-lib Explorer

NLAlib.sketchAndPrecondition

Library · def

The sketch-and-precondition iterate after q steps from \mathbf{x}_0, for \mathbf{A} \in \Bbbk^{m \times n}, a sketch \mathbf{S} \in \Bbbk^{k \times m} and \mathbf{y} \in \Bbbk^m: \mathsf{sketchAndPrecondition}(\mathbf{A}, \mathbf{S}, \mathbf{y}, \mathbf{x}_0, q) := \mathsf{pcgIterate}(\mathbf{A}^{\mathsf{H}}\mathbf{A}, \mathbf{G}^{+}, \mathbf{A}^{\mathsf{H}}\mathbf{y}, \mathbf{x}_0, q) with \mathbf{G} = (\mathbf{S}\mathbf{A})^{\mathsf{H}}\mathbf{S}\mathbf{A}: preconditioned CG on the normal equations, preconditioned by the sketched Gram matrix. Basis-free. For a QR factorization \mathbf{S}\mathbf{A} = \mathbf{Q}\mathbf{R} it is \mathbf{R}^{-1} times CGLS on \mathbf{A}\mathbf{R}^{-1} (NLAlib.IsQR.sketchAndPrecondition_eq_mulVec_cgIterate), which is preconditioned LSQR in exact arithmetic; for an SVD it uses LSRN's preconditioner (NLAlib.IsSVD.sketchAndPrecondition_eq_mulVec_cgIterate); the preconditioned Hestenes–Stiefel recurrence computes it (NLAlib.pcgState_x_eq_sketchAndPrecondition). The sketch-and-solve start is \mathbf{x}_0 = (\mathbf{S}\mathbf{A})^{+}\mathbf{S}\mathbf{y}. Junk value: that of NLAlib.pcgIterate when \mathbf{A} is rank deficient. [MartinssonTropp2020, §10.5]; [Epperly2024, Algorithm 1], there with LSQR and the QR preconditioner.

NLAlib.sketchAndPrecondition.{u_1, u_2, u_3, u_4} {𝕜 : Type u_1} [RCLike 𝕜] {k : Type u_2}
  {m : Type u_3} {n : Type u_4} [Fintype k] [Fintype m] [Fintype n] [DecidableEq n]
  (A : Matrix m n 𝕜) (S : Matrix k m 𝕜) (y : m → 𝕜) (x₀ : n → 𝕜) (q : ℕ) : n → 𝕜

Full source on GitHub

Import NLAlib.Regression.SketchAndPrecondition.