NLA-lib Explorer

Stochastic Lanczos quadrature

Average Lanczos-based quadrature over random probes to estimate spectral quantities.

Definition

Definition (Stochastic Lanczos quadrature). For s\ge1 random probes, approximate each quadratic form \mathbf{g}_i^{\mathsf{H}}f(\mathbf{A})\mathbf{g}_i by Lanczos quadrature and average the results. Isotropic probes connect their average to a spectral-function trace. Sampling error and quadrature error are distinct contributions; both must be controlled to obtain a trace-estimation guarantee.

Copy link

Components

Results

Theorem (The error of stochastic Lanczos quadrature and the minimax error).

for Hermitian \mathbf{A} with spectrum in [a, a'], f continuous on [a, a'], every test matrix \mathbf{\Omega} with m columns and q + 1 Lanczos steps per probe, \bigl\lvert\operatorname{tr} f(\mathbf{A}) - \mathsf{slq}(\mathbf{A}, f, \mathbf{\Omega}, q + 1)\bigr\rvert \le \bigl\lvert\operatorname{tr} f(\mathbf{A}) - \mathsf{girardHutchinson}(f(\mathbf{A}), \mathbf{\Omega})\bigr\rvert + \frac{2E_{2q + 1}(f; [a, a'])\|\mathbf{\Omega}\|_{\mathsf{F}}^2}{m} \,, E_{2q + 1} the error of the best uniform approximation of f on [a, a'] by polynomials of degree at most 2q + 1 (minimaxError). [UbaruChenSaad2017, §4] (locator to check); there with the quadrature error bounded through analytic f and Chebyshev approximation.

General form: sizes are index types

Lean statement and details
Matrix.IsHermitian.norm_trace_cfc_sub_slq_le_of_continuousOn.{u_1, u_2, u_3} {𝕜 : Type u_1}
  [RCLike 𝕜] {n : Type u_2} {m : Type u_3} [Fintype n] [DecidableEq n] [Fintype m]
  {A : Matrix n n 𝕜} (hA : A.IsHermitian) {a a' : ℝ} (hs : spectrum ℝ A ⊆ Set.Icc a a') {f : ℝ → ℝ}
  (hf : ContinuousOn f (Set.Icc a a')) (Ω : Matrix n m 𝕜) (q : ℕ) :
  ‖(cfc f A).trace - slq A f Ω (q + 1)‖ ≤
    ‖(cfc f A).trace - girardHutchinson (cfc f A) Ω‖ +
      2 * minimaxError f (Set.Icc a a') (2 * q + 1) * frobNorm Ω ^ 2 / ↑(Fintype.card m)

Full source on GitHub

Copy link

Theorem (The tail of stochastic Lanczos quadrature and the minimax error).

Let the entries of the real n \times m test matrix \mathbf{\Omega} be independent, each satisfying the sub-Gaussian moment generating function bound with variance proxy c (HasSubgaussianMGF) and having second moment 1. Let \mathbf{A} be real symmetric with spectrum in [a, a'] and f continuous on [a, a']. Then for every q and \tau \ge 0, with q + 1 Lanczos steps per probe, \mathbb{P}\Bigl[\tau + \frac{2E_{2q + 1}(f; [a, a'])\|\mathbf{\Omega}\|_{\mathsf{F}}^2}{m} \le \bigl\lvert\operatorname{tr} f(\mathbf{A}) - \mathsf{slq}(\mathbf{A}, f, \mathbf{\Omega}, q + 1)\bigr\rvert\Bigr] \le 2\exp\Bigl(-\frac{1}{196}\min\Bigl(\frac{m\tau^2}{c^2\|f(\mathbf{A})\|_{\mathsf{F}}^2}, \frac{m\tau}{c\|f(\mathbf{A})\|_2}\Bigr)\Bigr)\,; the constant is hansonWrightConstant; E_{2q + 1} is the error of the best uniform approximation of f on [a, a'] by polynomials of degree at most 2q + 1 (minimaxError), and the quadrature term is random, inside the event. Gaussian and sign test matrices are the case c = 1. [UbaruChenSaad2017, Theorem 4.1] (locator to check), there for positive definite \mathbf{A} with Rademacher probes and relative error; [CortinovisKressner2022, §4] (locator to check).

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_abs_trace_cfc_sub_slq_ge_le_of_continuousOn.{u_2, u_3, u_4} {n : Type u_2}
  {m : Type u_3} [Fintype n] [DecidableEq n] [Fintype m] {Ω : Type u_4} {mΩ : MeasurableSpace Ω}
  {μ : Measure Ω} {X : Ω → Matrix n m ℝ} {c : ℝ≥0} (hind : iIndepFun (fun p ω ↦ X ω p.1 p.2) μ)
  (hsub : ∀ (i : n) (j : m), HasSubgaussianMGF (fun ω ↦ X ω i j) c μ)
  (hvar : ∀ (i : n) (j : m), ∫ (ω : Ω), X ω i j ^ 2 ∂μ = 1) {A : Matrix n n ℝ} (hA : A.IsHermitian)
  {a a' : ℝ} (hs : spectrum ℝ A ⊆ Set.Icc a a') {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a a'))
  (q : ℕ) {τ : ℝ} (hτ : 0 ≤ τ) :
  μ.real
      {ω |
        τ + 2 * minimaxError f (Set.Icc a a') (2 * q + 1) * frobNorm (X ω) ^ 2 / ↑(Fintype.card m) ≤
          |(cfc f A).trace - slq A f (X ω) (q + 1)|} ≤
    2 *
      rexp
        (-(hansonWrightConstant *
            min (↑(Fintype.card m) * τ ^ 2 / (↑c ^ 2 * frobNorm (cfc f A) ^ 2))
              (↑(Fintype.card m) * τ / (↑c * specNorm (cfc f A)))))

Full source on GitHub

Copy link

Mathematical background

Appears under these tasks