NLA-lib Explorer

Hessenberg shifted QR (BGS)

A QR eigenvalue method preserves the spectrum through unitary similarities and exposes small subdiagonal couplings that can be discarded to split the eigenvalue problem. A shifting strategy chooses which similarities to apply; a deflation rule decides when to split. Different strategies give different algorithms.

This page is the Hessenberg shifted QR algorithm of Banks, Garza-Vargas and Srivastava (BGS): a shifting strategy with exceptional shifts for upper Hessenberg matrices that are diagonalizable with a bounded eigenvector condition number. The library has certified programs for it in exact arithmetic (BGS I) and in finite precision (BGS II); they are different programs, not one program under two models. BGS + Dense Schur (end-to-end) runs the finite-precision program inside a pipeline that accepts any dense matrix.

Definition (Shifted QR step). Choose a shift \mu_j and factor \mathbf{A}_j-\mu_j\mathbf{I}=\mathbf{Q}_j\mathbf{R}_j. Set \mathbf{A}_{j+1}=\mathbf{R}_j\mathbf{Q}_j+\mu_j\mathbf{I}=\mathbf{Q}_j^{\mathsf{H}}\mathbf{A}_j\mathbf{Q}_j. Thus each exact step preserves eigenvalues. Shift selection, deflation tests, and explicit or implicit execution belong to concrete variants. The target for a general matrix is Schur form, rather than necessarily a diagonal matrix.

Copy link

Outline shared by the programs

start from an upper Hessenberg matrix
while an active block remains:
    choose shifts and apply shifted QR steps
    when a subdiagonal coupling is sufficiently small:
        split into smaller diagonal blocks
    solve terminal blocks and collect their eigenvalues

For multiple shifts s_1,\ldots,s_k, the shift polynomial is p(z)=\prod_{j=1}^k(z-s_j). The exact-arithmetic program applies a sequence of single-shift steps. The candidate order, the shift search, the storage, and the operation model of each program are specified on its own page.

What is certified

The library proves normal-matrix and conditioned nonnormal-matrix decoupling results, together with the Ritz-quality or early-decoupling dichotomy. The exact-arithmetic program connects scalar execution to backward error, a directed forward-error bound, and resource accounting.

The exact-arithmetic program uses local spectral primitives for Ritz candidates and terminal blocks of order at most the shift degree k. These are explicit operation-model assumptions with declared costs. See that implementation for its precise boundary and input hypotheses.

The finite-precision program has its own certificate. Its arithmetic is a machine in the standard model with unit roundoff u, its terminal blocks are solved by a randomized small-block Schur solver, and with probability at least 1-\varphi over a random tape it stores a Schur pair of a nearby matrix; the eigenvalues are the diagonal. The page of that program has two models. In one the small-block solver is any routine meeting a Schur contract. In the other it is the randomized shifted inverse iteration of BGS III, and no hypothesis on a solver or on random matrices remains.

BGS + Dense Schur (end-to-end) removes the Hessenberg and conditioning hypotheses: for any dense \mathbf{A} it computes \widehat{\mathbf{U}} and an exactly upper triangular \widehat{\mathbf{T}}.

Programs

Components

Results

Theorem (Rapid decoupling for normal Hessenberg matrices).

let \mathbf{H}_0 be normal and upper Hessenberg, k = 2^m with m \ge 1 and k \le n, and 0 < \gamma < 1. With the exact Ritz values and B = \theta = \alpha = 1, the iteration \mathrm{Sh}_{k,1} is \delta-decoupled at some t \le \Bigl\lceil\frac{\log(1/\delta)}{\log(1/(1 - \gamma))}\Bigr\rceil for every \delta > 0; by NLAlib.length_shqrCandidates_le each iteration tries at most 1 + 12/\varepsilon^2 shifts, \varepsilon = ((1 - \gamma)^2/14^{1/k})^{k/(k-1)}. [BanksGarzaVargasSrivastava2021, Theorem 1.2] (Theorem 3.3 there for k = 2), which uses the separate strategy \mathrm{Sh}_{2,1} with a quadratic shift (z - r)^2 and whose exceptional-shift count does not reduce the potential as printed (gap G1); here as the case B = 1 of the general strategy.

Lean statement and details
IsStarNormal.exists_le_isDecoupled_shqrIterate_ritzValues {n : ℕ}
  {H₀ : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} (hN : IsStarNormal H₀) (hH : IsUpperHessenberg H₀)
  {m : ℕ} (hm : 1 ≤ m) (hmn : 2 ^ m ≤ n) {γ : ℝ} (hγ0 : 0 < γ) (hγ1 : γ < 1) {δ : ℝ} (hδ : 0 < δ) :
  ∃ t ≤ ⌈Real.log (1 / δ) / Real.log (1 / (1 - γ))⌉₊,
    IsDecoupled δ (shqrIterate 1 1 1 γ m (ritzValues (2 ^ m)) H₀ t)

Full source on GitHub

Copy link

Theorem (Rapid decoupling of the Hessenberg shifted QR algorithm).

with the strategy \mathrm{Sh}_{k,B}: let \mathbf{H}_0 be upper Hessenberg and diagonalizable, \mathbf{H}_0\mathbf{V} = \mathbf{V}\operatorname{diag}(\mathbf{d}) with \mathbf{V} invertible and \|\mathbf{V}\|_2\|\mathbf{V}^{-1}\|_2 \le B (so \kappa_V(\mathbf{H}_0) \le B); let k = 2^m, m \ge 1, k \le n; \theta \ge 1; \alpha \ge 1 with B^{4m} \le \alpha^k (e.g. \alpha = B^{4\log_2 k/k}); 0 < \gamma < 1; and let the Ritz-value oracle return, on every upper Hessenberg matrix with \psi_k > 0, k \theta-optimal Ritz values (as [BanksGarzaVargasSrivastava2021, Definition 1.5] requires only when the minimum is nonzero). Then for every \delta > 0 some t \le \Bigl\lceil\frac{\log(1/\delta)}{\log(1/(1 - \gamma))}\Bigr\rceil has \mathsf{shqrIterate}(\mathbf{H}_0)_t \delta-decoupled: a subdiagonal entry of modulus at most \delta\|\mathbf{H}_t\|_2. [BanksGarzaVargasSrivastava2021, Theorem 1.6, item 1], printed as \mathrm{dec}_\delta(\mathbf{H}_0) \le 4\log_2(1/\delta), which is false for \delta near 1 (gap G2 of the design note); here with the ceiling, \le 4\log_2(1/\delta) + 1 at \gamma = 0.2.

Lean statement and details
NLAlib.IsUpperHessenberg.exists_le_isDecoupled_shqrIterate {n : ℕ}
  {H₀ V : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} (hH : IsUpperHessenberg H₀) {d : Fin (n + 1) → ℂ}
  (hV : IsUnit V) (hHV : H₀ * V = V * diagonal d) {B θ α γ : ℝ} (hB : pseudoConditionNumber V ≤ B)
  {m : ℕ} (hm : 1 ≤ m) (hmn : 2 ^ m ≤ n) (hθ : 1 ≤ θ) (hα1 : 1 ≤ α) (hα : B ^ (4 * m) ≤ α ^ 2 ^ m)
  (hγ0 : 0 < γ) (hγ1 : γ < 1) {ritz : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ → List ℂ}
  (hritz :
    ∀ (H' : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ),
      IsUpperHessenberg H' →
        0 < hessenbergPotential (2 ^ m) H' →
          (ritz H').length = 2 ^ m ∧ IsOptimalRitzValues θ H' (ritz H'))
  {δ : ℝ} (hδ : 0 < δ) :
  ∃ t ≤ ⌈Real.log (1 / δ) / Real.log (1 / (1 - γ))⌉₊,
    IsDecoupled δ (shqrIterate B θ α γ m ritz H₀ t)

Full source on GitHub

Copy link

Theorem (The dichotomy for forward-approximate Ritz values).

let \mathbf{H} be upper Hessenberg with \mathbf{H}\mathbf{V} = \mathbf{V}\operatorname{diag}(\mathbf{d}), \mathbf{V} invertible, \kappa = \|\mathbf{V}\|_2\|\mathbf{V}^{-1}\|_2, eigenvalues separated by \Gamma; let 1 \le k \le n, x = (2\kappa^4)^{1/(2k)} < \theta, c = \tfrac12(\theta/x - 1), 0 < \beta < c\Gamma, and let rs be within \beta of the Ritz values of order k, entry by entry. Then rs is a set of \theta-optimal Ritz values, or some r in rs is an eigenvalue, or \tfrac25\,\psi_k(\mathbf{H})\Bigl(1 - \frac x\theta\Bigr) \le \kappa^{2/k}(\|\mathbf{H}\|_2 + \beta)\,\beta\,\|\mathbf{e}_n^{\mathsf{H}}(\mathbf{H} - r\mathbf{I})^{-k}\|^{1/k} for some r in rs. [BanksGarzaVargasSrivastava2022, Theorem 4.1], there with \tfrac12 for \tfrac25 (a factor k^{-1/(2k)}/2 \ge 2/5 is lost in its last display; gap G10) and \beta \le c\Gamma (which can let two eigenvalues share a Ritz value).

Lean statement and details
NLAlib.IsUpperHessenberg.isOptimalRitzValues_or_exists_mem_det_eq_zero_or_le {n : ℕ}
  {H V : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} (hH : IsUpperHessenberg H) {d : Fin (n + 1) → ℂ}
  (hV : IsUnit V) (hHV : H * V = V * diagonal d) {k : ℕ} (hk : 0 < k) (hkn : k ≤ n) {Γ θ β : ℝ}
  (hgap : ∀ (i j : Fin (n + 1)), i ≠ j → Γ ≤ ‖d i - d j‖)
  (hθ : (2 * pseudoConditionNumber V ^ 4) ^ (2 * ↑k)⁻¹ < θ) (hβ : 0 < β)
  (hβΓ : β < (θ / (2 * pseudoConditionNumber V ^ 4) ^ (2 * ↑k)⁻¹ - 1) / 2 * Γ) {rs : List ℂ}
  (hclose : List.Forall₂ (fun ρ r ↦ ‖ρ - r‖ ≤ β) (ritzValues k H) rs) :
  IsOptimalRitzValues θ H rs ∨
    ∃ r ∈ rs,
      (H - r • 1).det = 0 ∨
        2 / 5 * hessenbergPotential k H * (1 - (2 * pseudoConditionNumber V ^ 4) ^ (2 * ↑k)⁻¹ / θ) ≤
          pseudoConditionNumber V ^ (2 / ↑k) * (specNorm H + β) * β *
            ‖WithLp.toLp 2 (((H - r • 1)⁻¹ ^ k) (Fin.last n))‖ ^ (↑k)⁻¹

Full source on GitHub

Copy link

Source guide

Implementation guides

Mathematical background

Appears under these tasks