NLA-lib Explorer

Best-rank approximation and truncation

This topic contains reusable approximation theory. The choices of when to truncate a sketch or an approximation belong to the individual RSVD method pages.

Definition (Truncated SVD). Write [\mathbf{A}]_k for the matrix obtained by retaining the k largest singular values and their singular vectors. It has rank at most k. Ties can make the best approximation nonunique; the library fixes a choice.

Lean statement and details
NLAlib.truncatedSVD.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_2} {n : Type u_3}
  [Fintype m] [Fintype n] (A : Matrix m n 𝕜) (k : ℕ) : Matrix m n 𝕜

Full source on GitHub

Copy link

Background

Mathematical guarantees

Theorem (Eckart–Young optimality). If \operatorname{rank}(\mathbf{B})\le k, then

\|\mathbf{A}-[\mathbf{A}]_k\|_{\mathrm{F}}\le\|\mathbf{A}-\mathbf{B}\|_{\mathrm{F}}.

This reusable comparison separates the mathematical optimum from the error of a particular randomized or iterative algorithm.

Lean statement and details
NLAlib.frobNorm_sub_truncatedSVD_le_of_rank_le.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜]
  {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] (A : Matrix m n 𝕜) {B : Matrix m n 𝕜}
  {k : ℕ} (hB : B.rank ≤ k) : frobNorm (A - truncatedSVD A k) ≤ frobNorm (A - B)

Full source on GitHub

Copy link

Further results

Theorem (The tail of the singular values in the nuclear norm).

For every \mathbf{A} and every r \ge 1, \|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_r\|_{\mathsf{F}} \le \frac{\|\mathbf{A}\|_*}{2\sqrt{r}}\,: the tail \sum_{i \ge r}\sigma_i^2 is at most \sigma_{r-1}\sum_{i \ge r}\sigma_i \le (1/r)\bigl(\sum_{i < r}\sigma_i\bigr)\bigl(\sum_{i \ge r}\sigma_i\bigr) \le \|\mathbf{A}\|_*^2/(4r). The positive semidefinite form, with \operatorname{Re}\operatorname{tr}\mathbf{A}, is Matrix.PosSemidef.frobNorm_sub_truncatedSVD_le_re_trace_div. [GilbertStraussTroppVershynin2007, Lemma 7]; [MeyerMuscoMuscoWoodruff2021, Imported Lemma 13 and §5 after Theorem 10]; [EpperlyTroppWebber2024, Fact 5.5]; GSTV state it for vectors and the \ell_1 norm, MMMW for positive semidefinite matrices with the trace, remarking that the proof gives the nuclear norm for any \mathbf{A}.

Lean statement and details
NLAlib.frobNorm_sub_truncatedSVD_le_nuclearNorm_div.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜]
  {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] (A : Matrix m n 𝕜) {r : ℕ} (hr : 0 < r) :
  frobNorm (A - truncatedSVD A r) ≤ nuclearNorm A / (2 * √↑r)

Full source on GitHub

Copy link

Theorem (Localized hard truncation).

for \mathbf{B}, \mathbf{N} \in \Bbbk^{m \times n}, 1 \le k, \theta = \sigma_{k-1}(\mathbf{B}), a window a \le k \le b with 2\theta \le \sigma_i(\mathbf{B}) for i < a, \sigma_a(\mathbf{B}) \le 2\theta and \sigma_b(\mathbf{B}) \le \theta/2, and a best rank-k approximation \mathbf{Y} of \mathbf{B} + \mathbf{N}, with \mathbf{P}_i, \mathbf{P}'_i the range projectors of \llbracket\mathbf{B}\rrbracket_i and of its conjugate transpose and \mu = \|(\mathbf{P}_b - \mathbf{P}_a)\mathbf{N}(\mathbf{P}'_b - \mathbf{P}'_a)\|_2, then \|\mathbf{B} - \mathbf{Y}\|_{\mathsf{F}}^2 \le \|\mathbf{B} - \llbracket\mathbf{B}\rrbracket_k\|_{\mathsf{F}}^2 + 483k\,\|\mathbf{N}\|_2^2 + 32\,\theta\min(k, b - k)\,\mu\,. The noise enters the cross term only through its compression \mu to the singular subspaces within a factor 2 of the truncation level, and with weight \min(k, b - k) instead of k. The coefficients are the values attained by the proof, replacing the earlier rounded values 500 and 40. No printed source.

Lean statement and details
NLAlib.IsBestRankApprox.frobNorm_sub_sq_le_add_specNorm_sq_add_window.{u_1, u_2, u_3} {𝕜 : Type u_1}
  [RCLike 𝕜] {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] {B N Y : Matrix m n 𝕜} {k : ℕ}
  (hY : IsBestRankApprox (B + N) k Y) (hk : 1 ≤ k) {a b : ℕ} (hak : a ≤ k) (hkb : k ≤ b)
  (ha : ∀ i < a, 2 * singularValues B (k - 1) ≤ singularValues B i)
  (ha₂ : singularValues B a ≤ 2 * singularValues B (k - 1))
  (hb : singularValues B b ≤ singularValues B (k - 1) / 2) :
  frobNorm (B - Y) ^ 2 ≤
    frobNorm (B - truncatedSVD B k) ^ 2 + localTruncationNoiseConstant * ↑k * specNorm N ^ 2 +
      localTruncationWindowConstant * singularValues B (k - 1) * ↑(min k (b - k)) *
        specNorm
          ((rangeProjector (truncatedSVD B b) - rangeProjector (truncatedSVD B a)) * N *
            (rangeProjector (truncatedSVD B b)ᴴ - rangeProjector (truncatedSVD B a)ᴴ))

Full source on GitHub

Copy link

Theorem (Perturbed truncation).

For any \mathbf{C}, \mathbf{E} and any best rank-k approximation \mathbf{Y} of \mathbf{C} + \mathbf{E}, \|\mathbf{C} - \mathbf{Y}\|_{\mathsf{F}} \le \|\mathbf{C} - \llbracket\mathbf{C}\rrbracket_k\|_{\mathsf{F}} + 2\,\|\llbracket\mathbf{E}\rrbracket_{2k}\|_{\mathsf{F}}\,: truncating a perturbed matrix pays only the 2k leading singular values of the perturbation. In the Frobenius norm it dominates the constant-two lemma (NLAlib.IsBestRankApprox.matrixNorm_sub_le_add_two_mul), since \|\llbracket\mathbf{E}\rrbracket_{2k}\|_{\mathsf{F}} \le \|\mathbf{E}\|_{\mathsf{F}}. Proved without a literature source; the input is von Neumann's trace inequality [HornJohnson2013, Theorem 7.4.1.1]. Related: [TroppYurtseverUdellCevher2017, Proposition 6.1].

Lean statement and details
NLAlib.IsBestRankApprox.frobNorm_sub_le_add_frobNorm_truncatedSVD.{u_1, u_2, u_3} {𝕜 : Type u_1}
  [RCLike 𝕜] {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] {C E Y : Matrix m n 𝕜} {k : ℕ}
  (hY : IsBestRankApprox (C + E) k Y) :
  frobNorm (C - Y) ≤ frobNorm (C - truncatedSVD C k) + 2 * frobNorm (truncatedSVD E (2 * k))

Full source on GitHub

Copy link

Theorem (Reverse Eckart–Young for late-truncated Nyström).

for positive semidefinite \mathbf{H}, every measurable test matrix \mathbf{X} and a measurable choice \mathbf{Y} of best rank-k approximations of \mathsf{nystrom}(\mathbf{H}, \mathbf{X}), \mathbb{E}\|\mathbf{H} - \mathbf{Y}\|_2 + \|\mathbf{H} - \llbracket\mathbf{H}\rrbracket_k\|_* \le \sigma_k(\mathbf{H}) + \mathbb{E}\|\mathbf{H} - \llbracket\mathsf{nystrom}(\mathbf{H}, \mathbf{X})\rrbracket_k\|_*\,, for every law: a trace bound for truncated Nyström becomes a spectral one at no cost, for every choice of the truncation. Direct form at truncatedSVD: Matrix.PosSemidef.integral_specNorm_sub_truncatedSVD_nystrom_add_nuclearNorm_sub_truncatedSVD_le. [TroppYurtseverUdellCevher2017a, Proposition A.8 and App. A.6]; [Gu2015, Theorem 3.4]; there a deterministic step inside a Gaussian proof, here in expectation for every law, under a selector, subtraction-free, indices from 0.

Lean statement and details
Matrix.PosSemidef.integral_specNorm_sub_add_nuclearNorm_sub_truncatedSVD_le_of_isBestRankApprox_nystrom.{u_1,
    u_2, u_3, u_4}
  {𝕜 : Type u_1} [RCLike 𝕜] {Ω : Type u_2} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {n : Type u_3}
  {l : Type u_4} [Fintype n] [Fintype l] {H : Matrix n n 𝕜} {X : Ω → Matrix n l 𝕜}
  [IsProbabilityMeasure μ] (hH : H.PosSemidef) (hX : AEMeasurable X μ) {k : ℕ}
  {Y : Ω → Matrix n n 𝕜} (hY : ∀ (ω : Ω), IsBestRankApprox (nystrom H (X ω)) k (Y ω))
  (hYm : AEStronglyMeasurable Y μ) :
  ∫ (ω : Ω), specNorm (H - Y ω) ∂μ + nuclearNorm (H - truncatedSVD H k) ≤
    singularValues H k + ∫ (ω : Ω), nuclearNorm (H - truncatedSVD (nystrom H (X ω)) k) ∂μ

Full source on GitHub

Copy link

Theorem (The truncation lemma, constant one).

If \sigma_i(\hat{\mathbf{A}}) \le \sigma_i(\mathbf{A}) for every i and \mathbf{Y} is a best rank-k approximation of \hat{\mathbf{A}}, then in every unitarily invariant norm \|\mathbf{A} - \mathbf{Y}\|_{\Phi} \le \|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_k\|_{\Phi} + \|\mathbf{A} - \hat{\mathbf{A}}\|_{\Phi}\,. The hypothesis holds for \hat{\mathbf{A}} = \mathbf{P}\mathbf{A} with \mathbf{P} an orthogonal projector (IsStarProjection.singularValues_mul_le) and for Nyström of a positive semidefinite matrix (Matrix.PosSemidef.singularValues_nystrom_le); without it the constant is two (NLAlib.IsBestRankApprox.matrixNorm_sub_le_add_two_mul). [HalkoMartinssonTropp2011, Theorem 9.3]; there in the spectral norm, for \mathbf{P}\mathbf{A} and a spectral-best \mathbf{Y}; here every gauge, any dominated \hat{\mathbf{A}}, Frobenius-best \mathbf{Y}.

Lean statement and details
NLAlib.IsBestRankApprox.matrixNorm_sub_le_add_of_singularValues_le.{u_1, u_2, u_3} {𝕜 : Type u_1}
  [RCLike 𝕜] {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] {A Â Y : Matrix m n 𝕜} {k : ℕ}
  (hY : IsBestRankApprox  k Y) (h : ∀ (i : ℕ), singularValues  i ≤ singularValues A i)
  (Φ : SymmetricGauge) :
  Φ.matrixNorm (A - Y) ≤ Φ.matrixNorm (A - truncatedSVD A k) + Φ.matrixNorm (A - Â)

Full source on GitHub

Copy link

Formal definitions

Used by algorithms

15 algorithms using this topic or its subtopics

Range-finder approximation (RSVD)

Project the matrix onto the full range of its sketch.

Randomized subspace iteration (RSI)

Apply power iterations to the sketch, then project the matrix onto its range.

Late-truncated RSI

Complete randomized subspace iteration, then truncate the output to the target rank.

Randomized block Krylov iteration (RBKI)

Project the matrix onto a block Krylov space generated from its sketch.

Late-truncated RBKI

Complete randomized block Krylov iteration, then truncate the output to the target rank.

Nyström approximation

Approximate a positive-semidefinite matrix using sampled or sketched columns.

Generalized Nyström (GN)

Use two sketches to construct a low-rank approximation of a general matrix.

Late-truncated NysBKI

Complete Nyström block Krylov iteration, then truncate the output to the target rank.

Late-truncated NysSI

Complete Nyström subspace iteration, then truncate the output to the target rank.

Early-and-late-truncated RSVD

Select a reduced sketch range, then truncate the projected matrix to the target rank.

Early-truncated GN

Truncate the range sketch before completing the two-sided approximation.

Early-truncated RSVD

Truncate the sketch first, then project the matrix onto that smaller range.

Late-truncated GN

Complete generalized Nyström, then truncate the output to the target rank.

Late-truncated RSVD

Project onto the sketch range, then truncate the resulting approximation.

Pivoted Cholesky

Factor a positive-semidefinite matrix by selecting residual diagonal pivots.

Broader topics