NLA-lib Explorer

Early-truncated RSVD

Definition (Early-truncated RSVD). Form the sketch \mathbf{Y}=\mathbf{A}\mathbf\Omega, retain its best rank-at-most-k approximation [\mathbf{Y}]_k, then return \mathbf{P}_{[\mathbf{Y}]_k}\mathbf{A}. The retained subspace is chosen from the sketch, rather than from the full projected matrix.

Lean statement and details
NLAlib.earlyTruncatedRSVD.{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 𝕜) (k : ℕ) : Matrix m n 𝕜

Full source on GitHub

Copy link

Implementations

Mathematical guarantees

Early truncation needs control of how the sketch preserves useful subspaces and projection costs. Its bounds belong here, separately from late truncation's error decomposition. The existing structural and projection-cost results are linked below.

Theorem (The early-truncated randomized SVD has excess \Omega(\sqrt{k/\ell})).

there are absolute constants c, C > 0 and K_0 such that for every k \ge K_0, a standard Gaussian 2k \times \ell test matrix \mathbf{\Omega} with \ell \ge Ck, and \mathbf{A} = \operatorname{diag}(\mathbf{I}_k, (1 - \delta)\mathbf{I}_k) with \delta = \sqrt{k/\ell}/4, \Bigl(1 + c\sqrt{k/\ell}\Bigr)\|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_k\|_{\mathsf{F}}^2 \le \mathbb{E}\|\mathbf{A} - \mathsf{earlyTruncatedRSVD}(\mathbf{A}, \mathbf{\Omega}, k) \|_{\mathsf{F}}^2\,. So relative error 1 + \varepsilon needs \ell \ge c^2k/\varepsilon^2: the k-dependence of the library's 900k/\varepsilon^2 is also sharp. The constants are existential: the proof gives c = 1/(96 \cdot 10^7), C = 10^4, K_0 = 4000; numerically c \approx 0.2 for every k \ge 1. k \ge K_0 is where the proof's concentration events have probability at least 1/24; for 2 \le k < K_0 the statement is expected but not proved. No printed source. New.

General form: sizes are index types

Lean statement and details
NLAlib.exists_forall_le_integral_frobNorm_sub_earlyTruncatedRSVD_sq_of_hasLaw_gaussianMatrix :
  ∃ c C K₀,
    0 < c ∧
      0 < C ∧
        ∀ {Ω l : Type} [inst : MeasurableSpace Ω] [inst_1 : Fintype l] (μ : Measure Ω) (k : ℕ)
          (X : Ω → Matrix (Fin k ⊕ Fin k) l ℝ) (A : Matrix (Fin k ⊕ Fin k) (Fin k ⊕ Fin k) ℝ),
          HasLaw X (gaussianMatrix (Fin k ⊕ Fin k) l) μ →
            K₀ ≤ k →
              C * ↑k ≤ ↑(Fintype.card l) →
                A = fromBlocks 1 0 0 ((1 - √(↑k / ↑(Fintype.card l)) / 4) • 1) →
                  (1 + c * √(↑k / ↑(Fintype.card l))) * frobNorm (A - truncatedSVD A k) ^ 2 ≤
                    ∫ (ω : Ω), frobNorm (A - earlyTruncatedRSVD A (X ω) k) ^ 2 ∂μ

Full source on GitHub

Copy link

Theorem (Early-truncated generalized Nyström through a random projection-cost-preserving sketch).

if \mathbf{\Omega}^{\mathsf{H}} is a rank-k projection-cost-preserving sketch for \mathbf{A} with constants a \ge 0, b except with probability \delta, and an independent co-range test matrix \mathbf{\Psi} has \mathbf{\Psi}^{\mathsf{H}} an oblivious subspace injection for dimension k with constant a' > 0 and failure probability \delta', then for t > 0 a\|\mathbf{A} - \mathsf{earlyTruncatedGN}(\mathbf{A}, \mathbf{\Omega}, \mathbf{\Psi}, k) \|_{\mathsf{F}}^2 \le \Bigl(1 + \frac{t}{a'}\Bigr) b\, \|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_k\|_{\mathsf{F}}^2 except with probability \delta + \delta' + 1/t. One pass, rank at most k. Proved as the union of the events of NLAlib.HasProjectionCostPreserving.measureReal_mul_frobNorm_sub_earlyTruncatedRSVD_sq_gt_le and the completion step NLAlib.IsObliviousSubspaceInjection.measureReal_frobNorm_sub_earlyTruncatedGeneralizedNystrom_sq_gt_mul_le. For real sketches with the JL moment property NLAlib.HasJLMoment.measureReal_frobNorm_sub_earlyTruncatedGeneralizedNystrom_sq_gt_le uses no projection-cost-preserving event and has no 1/t term; this is the form for a sketch known only to be projection-cost-preserving. [TroppYurtseverUdellCevher2017, §7.3.1], the algorithm and the remark that the results of [CohenElderMuscoMuscoPersu2015, Theorem 12 and §10.1] imply a (1+\varepsilon) bound at \Theta(r/\varepsilon^2) for both sketch sizes, with unspecified constants; here explicit, with failure probability \delta + \delta' + 1/t.

Lean statement and details
NLAlib.HasProjectionCostPreserving.measureReal_mul_frobNorm_sub_earlyTruncatedGeneralizedNystrom_sq_gt_le.{u_1,
    u_2, u_3, u_4, u_5, u_6}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {m : Type u_3}
  {n : Type u_4} {l : Type u_5} {p : Type u_6} [Fintype m] [Fintype n] [Fintype l] [Fintype p]
  [DecidableEq m] {X : Ω → Matrix n l 𝕜} {Ψ : Ω → Matrix m p 𝕜} [IsProbabilityMeasure μ]
  {A : Matrix m n 𝕜} {k : ℕ} {a b δ a' δ' t : ℝ}
  (h : HasProjectionCostPreserving (fun ω ↦ (X ω)ᴴ) A k a b δ μ) (ha : 0 ≤ a)
  (hΨ : IsObliviousSubspaceInjection (fun ω ↦ (Ψ ω)ᴴ) k a' δ' μ) (ha' : 0 < a') (ht : 0 < t)
  (hind : X ⟂ᵢ[μ] Ψ) (hX : AEMeasurable X μ) (hΨm : AEMeasurable Ψ μ) :
  μ.real
      {ω |
        (1 + t / a') * b * frobNorm (A - truncatedSVD A k) ^ 2 <
          a * frobNorm (A - earlyTruncatedGeneralizedNystrom A (X ω) (Ψ ω) k) ^ 2} ≤
    δ + δ' + 1 / t

Full source on GitHub

Copy link

Theorem (Early-truncated randomized SVD, structural bound).

For \mathbf{Z} with orthonormal columns, \lvert r \rvert \le k, \mathbf{\Omega}^{\mathsf{H}} a subspace injection for \operatorname{range}\mathbf{Z} with constant 0 < \lambda \le 1, and 0 < \theta < 1, with \mathbf{E} = \mathbf{A} - \mathbf{A}\mathbf{Z}\mathbf{Z}^{\mathsf{H}},\qquad w = \|\mathbf{E}\mathbf{\Omega}\mathbf{\Omega}^{\mathsf{H}}\mathbf{E}^{\mathsf{H}} - \mathbf{E}\mathbf{E}^{\mathsf{H}}\|_{\mathsf{F}},\qquad \chi = \|\mathbf{E}\mathbf{\Omega}\mathbf{\Omega}^{\mathsf{H}}\mathbf{Z} - \mathbf{E}\mathbf{Z}\|_{\mathsf{F}}, \|\mathbf{A} - \mathsf{earlyTruncatedRSVD}(\mathbf{A}, \mathbf{\Omega}, k) \|_{\mathsf{F}}^2 \le \frac{\|\mathbf{E}\|_{\mathsf{F}}^2 + \sqrt{k}\,w}{(1-\theta)\lambda} + \frac{\chi^2}{\theta(1-\theta)\lambda^2}\,, for every choice of the truncation. With \mathbf{A}\mathbf{Z}\mathbf{Z}^{\mathsf{H}} = \llbracket\mathbf{A}\rrbracket_k (NLAlib.exists_hasOrthonormalCols_mul_mul_conjTranspose_eq_truncatedSVD, for k \le \lvert n \rvert) \|\mathbf{E}\|_{\mathsf{F}} is the optimal error. The hypothesis \lvert r \rvert \le k is needed (\mathbf{A} = \mathbf{\Omega} = \mathbf{Z} = \mathbf{I}_2, k = 1). Proved without a literature source; the sketch quantities are those of [CohenElderMuscoMuscoPersu2015, proof of Theorem 12].

General form: sizes are index types

Lean statement and details
NLAlib.IsSubspaceInjection.frobNorm_sub_earlyTruncatedRSVD_sq_le.{u_1, u_2, u_3, u_4, u_5}
  {𝕜 : Type u_1} [RCLike 𝕜] {l : Type u_2} {m : Type u_3} {n : Type u_4} {r : Type u_5} [Fintype l]
  [Fintype m] [Fintype n] [Fintype r] [DecidableEq r] {Ω : Matrix n l 𝕜} {Z : Matrix n r 𝕜}
  {a θ : ℝ} (h : IsSubspaceInjection Ωᴴ Z a) (hZ : HasOrthonormalCols Z) {k : ℕ}
  (hk : Fintype.card r ≤ k) (ha : 0 < a) (ha1 : a ≤ 1) (hθ : 0 < θ) (hθ1 : θ < 1)
  (A : Matrix m n 𝕜) :
  frobNorm (A - earlyTruncatedRSVD A Ω k) ^ 2 ≤
    (frobNorm (A - A * Z * Zᴴ) ^ 2 +
          √↑k *
            frobNorm
              ((A - A * Z * Zᴴ) * Ω * Ωᴴ * (A - A * Z * Zᴴ)ᴴ -
                (A - A * Z * Zᴴ) * (A - A * Z * Zᴴ)ᴴ)) /
        ((1 - θ) * a) +
      frobNorm ((A - A * Z * Zᴴ) * Ω * Ωᴴ * Z - (A - A * Z * Zᴴ) * Z) ^ 2 / (θ * (1 - θ) * a ^ 2)

Full source on GitHub

Copy link

Theorem (Early-truncated randomized SVD).

with \ell \ge 900k/\varepsilon^2 standard Gaussian samples, 0 < \varepsilon \le 1: \mathbb{E}\|\mathbf{A} - \mathsf{earlyTruncatedRSVD}(\mathbf{A}, \mathbf{\Omega}, k) \|_{\mathsf{F}}^2 \le (1+\varepsilon)\|\mathbf{A}-\llbracket\mathbf{A}\rrbracket_k \|_{\mathsf{F}}^2\,, with \ell products with \mathbf{A}, at most k with \mathbf{A}^{\mathsf{H}}, and output rank at most k. Asymptotic form: NLAlib.exists_forall_integral_frobNorm_sub_earlyTruncatedRSVD_sq_le_of_hasLaw_gaussianMatrix. Proved without a literature source; the algorithm is [TroppYurtseverUdellCevher2017, §7.3.1].

General form: sizes are index types

Lean statement and details
NLAlib.integral_frobNorm_sub_earlyTruncatedRSVD_sq_le_one_add_mul_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 : ℕ} {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1)
  (hl : 900 * ↑k ≤ ε ^ 2 * ↑(Fintype.card l)) :
  ∫ (ω : Ω), frobNorm (A - earlyTruncatedRSVD A (X ω) k) ^ 2 ∂μ ≤
    (1 + ε) * frobNorm (A - truncatedSVD A k) ^ 2

Full source on GitHub

Copy link

Mathematical background

Family

Appears under these tasks