NLA-lib Explorer

Range-finder approximation (RSVD)

Let \mathbf{Y}=\mathbf{A}\mathbf\Omega and let \mathbf{P}_{\mathbf{Y}} be the orthogonal projector onto its range.

Definition (Range-finder approximation). The untruncated approximation is \mathbf{B}=\mathbf{P}_{\mathbf{Y}}\mathbf{A}. Its rank is at most the sketch width; a target rank k is not imposed at this stage.

Lean statement and details
NLAlib.rsvd.{u_1, u_2, u_3, u_4} {𝕜 : Type u_1} [RCLike 𝕜] {l : Type u_2} {m : Type u_3}
  {n : Type u_4} [Fintype l] [Fintype m] [Fintype n] (A : Matrix m n 𝕜) (Ω : Matrix n l 𝕜) :
  Matrix m n 𝕜

Full source on GitHub

Copy link

Implementations

Mathematical guarantees

Theorem (Expected Frobenius error). For a real matrix \mathbf{A}, a standard Gaussian test matrix \mathbf\Omega\in\mathbb{R}^{n\times\ell}, and k+2\le\ell,

\mathbb{E}\|\mathbf{A}-\mathbf{P}_{\mathbf{A}\mathbf\Omega}\mathbf{A}\|_{\mathrm{F}}^2\le\left(1+\frac{k}{\ell-k-1}\right)\|\mathbf{A}-[\mathbf{A}]_k\|_{\mathrm{F}}^2.

Here [\mathbf{A}]_k is a best rank-at-most-k approximation. Increasing the sketch width above k reduces the multiplicative excess over the optimal squared error.

Lean statement and details

General form: sizes are index types

NLAlib.integral_frobNorm_sub_rsvd_sq_le_of_hasLaw_gaussianMatrix.{u_1, u_2, u_3, u_4} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {m : Type u_2} {n : Type u_3} {l : Type u_4} [Fintype m]
  [Fintype n] [Fintype l] {X : Ω → Matrix n l ℝ} (A : Matrix m n ℝ)
  (hX : HasLaw X (gaussianMatrix n l) μ) {k : ℕ} (hk : k + 2 ≤ Fintype.card l) :
  ∫ (ω : Ω), frobNorm (A - rsvd A (X ω)) ^ 2 ∂μ ≤
    gaussianProjectionFactor k (Fintype.card l) * frobNorm (A - truncatedSVD A k) ^ 2

Full source on GitHub

Copy link

The range approximation is the common starting point for late truncation. Early truncation instead selects a smaller subspace from the sketch before projecting the matrix.

Theorem (Epperly and Webber's randomized SVD factor is sharp).

for a test matrix \mathbf{X} with a left unitarily invariant law and full column rank almost surely, q + 2 \le \ell \le r, r \le \min(m, n) and every c below the factor, c < \frac{r - \ell}{r - q}\Bigl(1 + \frac{q}{\ell - q - 1}\Bigr)\,, there is \mathbf{A} \in \mathbb{R}^{m \times n} of rank r with c\,\|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_q\|_{\mathsf{F}}^2 < \mathbb{E}\|\mathbf{A} - \mathsf{rsvd}(\mathbf{A}, \mathbf{X})\|_{\mathsf{F}}^2\,. The matching upper bound is NLAlib.integral_frobNorm_sub_rsvd_sq_le_of_isLeftUnitarilyInvariant_of_rank_le. [EpperlyWebber2026, Theorem 3.3]; there for every full-rank law, here for left unitarily invariant laws.

General form: sizes are index types

Lean statement and details
NLAlib.exists_lt_integral_frobNorm_sub_rsvd_sq_of_isLeftUnitarilyInvariant.{u_1, u_2, u_3, u_4}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {m : Type u_2} {n : Type u_3}
  {l : Type u_4} [Fintype m] [Fintype n] [Fintype l] {X : Ω → Matrix n l ℝ} [DecidableEq n]
  {ν : Measure (Matrix n l ℝ)} [IsProbabilityMeasure ν] [IsLeftUnitarilyInvariant ν]
  (hX : HasLaw X ν μ) (hXr : ∀ᵐ (ω : Ω) ∂μ, Function.Injective (X ω).mulVec) {r q : ℕ}
  (hq : q + 2 ≤ Fintype.card l) (hlr : Fintype.card l ≤ r) (hrm : r ≤ Fintype.card m)
  (hrn : r ≤ Fintype.card n) {c : ℝ} (hc : c < rotationInvariantFactor r (Fintype.card l) q) :
  ∃ A,
    A.rank = r ∧
      c * frobNorm (A - truncatedSVD A q) ^ 2 < ∫ (ω : Ω), frobNorm (A - rsvd A (X ω)) ^ 2 ∂μ

Full source on GitHub

Copy link

Theorem (Randomized SVD: tail bounds).

for \mathbf{A} \in \mathbb{R}^{m \times n}, a test matrix \mathbf{X} \in \mathbb{R}^{n \times \ell} with independent standard Gaussian entries (HasLaw X (gaussianMatrix n l) μ), a target rank k with d = \ell - k + 1 (hd : k + d = Fintype.card l + 1), s \ge 0 and t > 0, \mathbb{P}\Bigl[\|\mathbf{A} - \mathsf{rsvd}(\mathbf{A}, \mathbf{X})\|_{\mathsf{F}}^2 > \|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_k\|_{\mathsf{F}}^2 + \frac{tk}{d}\bigl( \|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_k\|_{\mathsf{F}} + s\,\sigma_k(\mathbf{A})\bigr)^2\Bigr] \le e^{-s^2/2} + \frac{2\sqrt{k}\,(d/(2t))^{d/2}}{\Gamma(d/2 + 1)}\,, the second failure term being gaussianPinvFrobTail k d t. [TroppWebber2023, Theorem 8.1 (RSVD1)]; there at p = 2, with the noise term (utk/d)\|\mathbf{E}\|_{\mathsf{F}}^2 and the failure probability e^{-(u-2)/4} + \sqrt{\pi k}\,(t/e)^{-d/2}, which follow from this bound at s = \sqrt{u} - 1.

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_frobNorm_sub_rsvd_sq_gt_le_of_hasLaw_gaussianMatrix.{u_1, u_2, u_3, u_4}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {m : Type u_2} {n : Type u_3}
  {l : Type u_4} [Fintype m] [Fintype n] [Fintype l] {X : Ω → Matrix n l ℝ} (A : Matrix m n ℝ)
  (hX : HasLaw X (gaussianMatrix n l) μ) {k d : ℕ} (hd : k + d = Fintype.card l + 1) {s t : ℝ}
  (hs : 0 ≤ s) (ht : 0 < t) :
  μ.real
      {ω |
        frobNorm (A - truncatedSVD A k) ^ 2 +
            t * ↑k / ↑d * (frobNorm (A - truncatedSVD A k) + s * singularValues A k) ^ 2 <
          frobNorm (A - rsvd A (X ω)) ^ 2} ≤
    rexp (-s ^ 2 / 2) + gaussianPinvFrobTail k d t

Full source on GitHub

Copy link

Theorem (The structural bound of the range finder, Frobenius form).

For \mathbf{A} \in \Bbbk^{m \times n}, \mathbf{\Omega} \in \Bbbk^{n \times l} and \mathbf{Z} \in \Bbbk^{n \times r} with orthonormal columns and \mathbf{Z}^{\mathsf{H}}\mathbf{\Omega} of full row rank ((Ωᴴ * Z).rank = Z.rank), with \mathbf{E} = \mathbf{A} - \mathbf{A}\mathbf{Z}\mathbf{Z}^{\mathsf{H}} and \mathbf{M} = \mathbf{E}\mathbf{\Omega}(\mathbf{Z}^{\mathsf{H}}\mathbf{\Omega})^{+}, \|\mathbf{A} - \mathsf{rsvd}(\mathbf{A}, \mathbf{\Omega})\|_{\mathsf{F}}^2 \le \|\mathbf{E}\|_{\mathsf{F}}^2 + \|\mathbf{M}\|_{\mathsf{F}}^2\,. [HalkoMartinssonTropp2011, Theorem 9.1]; [Woodruff2014, Lemma 48]; [CamanoEpperlyMeyerTropp2025, Imported Theorem 2.3]; there for a top-k frame (HMT, CEMT) or any frame over \mathbb{R} (Woodruff).

Lean statement and details
NLAlib.HasOrthonormalCols.frobNorm_sub_rsvd_sq_le.{u_1, u_2, u_3, u_4, u_5} {𝕜 : Type u_1}
  [RCLike 𝕜] {m : Type u_2} {n : Type u_3} {l : Type u_4} {r : Type u_5} [Fintype m] [Fintype n]
  [Fintype l] [Fintype r] {Ω : Matrix n l 𝕜} {Z : Matrix n r 𝕜} [DecidableEq r]
  (hZ : HasOrthonormalCols Z) (hΩ : (Ωᴴ * Z).rank = Z.rank) (A : Matrix m n 𝕜) :
  frobNorm (A - rsvd A Ω) ^ 2 ≤
    frobNorm (A - A * Z * Zᴴ) ^ 2 + frobNorm ((A - A * Z * Zᴴ) * Ω * pinv (Zᴴ * Ω)) ^ 2

Full source on GitHub

Copy link

Used by other algorithms

Mathematical background

Family

Appears under these tasks