Definition (Sketch-and-precondition least squares). Use a sketch to construct a preconditioner, then solve the original least-squares objective in transformed coordinates. For example, if a thin QR factorization \mathbf{S}\mathbf{A}=\mathbf{Q}\mathbf{R} has invertible \mathbf{R}, solve \min_{\mathbf{y}}\|\mathbf{A}\mathbf{R}^{-1}\mathbf{y}-\mathbf{b}\|_2 and recover \mathbf{x}=\mathbf{R}^{-1}\mathbf{y}. The sketch improves the coordinates; it does not replace the original objective.
Sketch-and-precondition least squares
Build a preconditioner from a sketch before solving the original problem.
Definition
Results
Theorem (Sketch-and-precondition).
if \mathbf{S} embeds \operatorname{range}\mathbf{A} with constants a > 0, b \ge 0 and \mathbf{S}\mathbf{A}\mathbf{M} has orthonormal columns, the preconditioned matrix has pseudo-condition number (NLAlib.pseudoConditionNumber) \bigl(\|\mathbf{A}\mathbf{M}\|_2 \|(\mathbf{A}\mathbf{M})^{+}\|_2\bigr)^2 \le \frac{b}{a}\,. For empty r (the column index of \mathbf{M}) the pseudo-condition number is 0 and the bound is the hypothesis 0 \le b; for nonempty r the hypotheses force 0 < b. No rank hypothesis is needed: \mathbf{A}\mathbf{M} has full column rank because \mathbf{S}\mathbf{A}\mathbf{M} does, so the pseudo-condition number is the classical \sigma_0(\mathbf{A}\mathbf{M}) / \sigma_{\min}(\mathbf{A}\mathbf{M}) (NLAlib.pseudoConditionNumber_of_injective). [MartinssonTropp2020, §10.5]; there for \mathbf{M} = \mathbf{R}^{-1} from a QR factorization of \mathbf{S}\mathbf{A}.
Lean statement and details
NLAlib.IsSubspaceEmbedding.pseudoConditionNumber_mul_sq_le.{u_1, u_2, u_4, u_6, u_7} {š : Type u_1}
[RCLike š] {k : Type u_2} {n : Type u_4} {q : Type u_6} {r : Type u_7} [Fintype k] [Fintype n]
[Fintype q] {S : Matrix k n š} {A : Matrix n q š} {a b : ā} [Fintype r] [DecidableEq r]
{M : Matrix q r š} (h : IsSubspaceEmbedding S A a b) (ha : 0 < a) (hb : 0 ⤠b)
(hM : HasOrthonormalCols (S * A * M)) : pseudoConditionNumber (A * M) ^ 2 ⤠b / aTheorem (Sketch-and-precondition converges geometrically).
if \mathbf{S} is a subspace embedding of \operatorname{range}\mathbf{A} with constants a > 0, b in squared norms (a\|\mathbf{v}\|^2 \le \|\mathbf{S}\mathbf{v}\|^2 \le b\|\mathbf{v}\|^2 for \mathbf{v} \in \operatorname{range}\mathbf{A}), \mathbf{A} has full column rank and \mathbf{x}_\star is a least-squares solution of \mathbf{A}\mathbf{x} \approx \mathbf{y}, then for every start \mathbf{x}_0 and every q \|\mathbf{A}(\mathbf{x}_\star - \mathsf{sketchAndPrecondition}(\mathbf{A}, \mathbf{S}, \mathbf{y}, \mathbf{x}_0, q))\|^2 \le 4\Bigl(\frac{\sqrt{b/a} - 1}{\sqrt{b/a} + 1}\Bigr)^{2q} \|\mathbf{A}(\mathbf{x}_\star - \mathbf{x}_0)\|^2\,. In the unsquared distortion \eta of Epperly (a = (1 - \eta)^2, b = (1 + \eta)^2) the rate is exactly \eta. [MartinssonTropp2020, §10.5], there a residual bound after j \sim \log(1/\varepsilon) steps with no constants; [EpperlyMeierNakatsukasa2024, Fact 2.2], the conditioning that gives the rate.
Lean statement and details
NLAlib.IsSubspaceEmbedding.norm_mulVec_sub_sketchAndPrecondition_sq_le_four_mul_pow.{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] {S : Matrix k m š} {A : Matrix m n š} {y : m ā š} {xs : n ā š}
{a b : ā} (h : IsSubspaceEmbedding S A a b) (ha : 0 < a) (hA : Function.Injective A.mulVec)
(hxs : IsLeastSquaresSolution A y xs) (xā : n ā š) (q : ā) :
āWithLp.toLp 2 (A *ᵄ (xs - sketchAndPrecondition A S y xā q))ā ^ 2 ā¤
4 * ((ā(b / a) - 1) / (ā(b / a) + 1)) ^ (2 * q) * āWithLp.toLp 2 (A *ᵄ (xs - xā))ā ^ 2Theorem (Sketch-and-precondition with a random embedding, sketch-and-solve start).
if the random sketch \mathbf{S} is a subspace embedding of \operatorname{range}[\mathbf{A}\ \mathbf{y}] with constants a > 0, b in squared norms (a\|\mathbf{v}\|^2 \le \|\mathbf{S}\mathbf{v}\|^2 \le b\|\mathbf{v}\|^2 on that range) except with probability \delta, \mathbf{A} has full column rank and almost surely \mathbf{x}_0 minimizes \|\mathbf{S}(\mathbf{A}\mathbf{x} - \mathbf{y})\|, then \mathbb{P}\Bigl[\Bigl(1 + 4\Bigl(\frac{b}{a} - 1\Bigr) \Bigl(\frac{\sqrt{b/a} - 1}{\sqrt{b/a} + 1}\Bigr)^{2q}\Bigr) \|(\mathbf{I} - \mathbf{P}_{\mathbf{A}})\mathbf{y}\|^2 < \|\mathbf{y} - \mathbf{A}\,\mathsf{sketchAndPrecondition}(\mathbf{A}, \mathbf{S}, \mathbf{y}, \mathbf{x}_0, q)\|^2\Bigr] \le \delta\,. Squared residuals; [MartinssonTropp2020, §10.5] states an unsquared 1 + \varepsilon. No law is assumed: any distribution with the embedding property qualifies.
Lean statement and details
NLAlib.HasSubspaceEmbedding.measureReal_norm_sub_mulVec_sketchAndPrecondition_sq_gt_le.{u_1, u_2,
u_3, u_4, u_6}
{š : 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 š} {y : m ā š} {a b : ā} {Ī© : Type u_6}
{mĪ© : MeasurableSpace Ī©} {μ : Measure Ī©} {Ī“ : ā} [DecidableEq m] [IsFiniteMeasure μ]
{S : Ī© ā Matrix k m š} (h : HasSubspaceEmbedding S (A.fromCols (replicateCol Unit y)) a b Ī“ μ)
(ha : 0 < a) (hA : Function.Injective A.mulVec) {xā : Ī© ā n ā š}
(hxā : āįµ (Ļ : Ī©) āμ, IsLeastSquaresSolution (S Ļ * A) (S Ļ *ᵄ y) (xā Ļ)) (q : ā) :
μ.real
{Ļ |
(1 + 4 * (b / a - 1) * ((ā(b / a) - 1) / (ā(b / a) + 1)) ^ (2 * q)) *
āWithLp.toLp 2 ((1 - rangeProjector A) *ᵄ y)ā ^ 2 <
āWithLp.toLp 2 (y - A *ᵄ sketchAndPrecondition A (S Ļ) y (xā Ļ) q)ā ^ 2} ā¤
ΓTheorem (Sketch-and-precondition is CGLS on \mathbf{A}\mathbf{M}).
for \mathbf{A} \in \Bbbk^{m \times n}, a sketch \mathbf{S}, a square \mathbf{M} with \mathbf{S}\mathbf{A}\mathbf{M} orthonormal and \mathbf{M}\mathbf{z}_0 = \mathbf{x}_0, \mathsf{sketchAndPrecondition}(\mathbf{A}, \mathbf{S}, \mathbf{y}, \mathbf{x}_0, q) = \mathbf{M}\,\mathsf{cgIterate}((\mathbf{A}\mathbf{M})^{\mathsf{H}}\mathbf{A}\mathbf{M}, (\mathbf{A}\mathbf{M})^{\mathsf{H}}\mathbf{y}, \mathbf{z}_0, q)\,. Orthonormality makes \mathbf{M} and \mathbf{A} injective, so no rank hypothesis is needed. [EpperlyMeierNakatsukasa2024, §2.1], there for \mathbf{M} = \mathbf{R}^{-1}, where CG on the preconditioned normal equations is LSQR in exact arithmetic.
Lean statement and details
NLAlib.HasOrthonormalCols.sketchAndPrecondition_eq_mulVec_cgIterate.{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] {S : Matrix k m š} {A : Matrix m n š} {xā : n ā š} {M : Matrix n n š}
(hSAM : HasOrthonormalCols (S * A * M)) (y : m ā š) {zā : n ā š} (hzā : M *ᵄ zā = xā) (q : ā) :
sketchAndPrecondition A S y xā q = M *ᵄ cgIterate ((A * M)į““ * (A * M)) ((A * M)į““ *ᵄ y) zā qMathematical background
Subspaces and projectors
Orthonormal bases, projectors, angles, and approximation by subspaces.
Random matrices and sketch laws
Gaussian matrices, Haar frames, CountSketch, and subsampled randomized Hadamard transforms.
Embeddings and sketch guarantees
JohnsonāLindenstrauss, subspace embeddings, approximate matrix multiplication, and projection-cost preservation.