NLA-lib Explorer

NLAlib.ShiftedQR.shTestStep_writes

Library · theorem

This statement changed in the recorded rename: 2026-11-schur.

Standard rounding

The computation of the comptau test on a scalar machine with the standard model at (n + 1)\boldsymbol{u} \le 1/2500 and 30000(k + 1)\boldsymbol{u} \le 1, with exact comparisons: let \mathbf{H} \ne 0 of order n + 1 be upper Hessenberg at A, \mathbf{H}\mathbf{V} = \mathbf{V}\operatorname{diag}(\mathbf{e}) with \kappa(\mathbf{V}) \le \kappa, the shift r at Z with \lvert r\rvert \le C\|\mathbf{H}\|_2 (C \ge 0) at distance at least d > 0 from every e_i, the word c at Cg, 1 \le k \le n, and 300(n+1)^2\boldsymbol{u} \le (8004\kappa)^{-1}(d/((2 + 2C)\|\mathbf{H}\|_2))^k. Then NLAlib.ShiftedQR.shTestStep writes only its four outputs, stores at T a backward-stable degree k step \widehat{\mathbf{H}} with the shift r repeated (relative error 300(n+1)^2\boldsymbol{u}), upper Hessenberg, at P0 a value within 0.001, relatively, of \|\mathbf{e}_n^{\mathsf{T}}(\mathbf{H} - r)^{-k}\|^{-1}, and at P1 the threshold NLAlib.ShiftedQR.optimalThresholdWord. Shared by the trees of NLAlib.ShiftedQR.shqrSmallEigRoutine, on their scratch.

NLAlib.ShiftedQR.shTestStep_writes {O Q : Type} [Ops.Has Ops.ScalarOp O] [Ops.Has Ops.IndexOp O]
  [Ops.Has Ops.CmpTst Q] {M : Ops.Machine ℝ} {I : Ops.Interp O Q ℝ} {u : ℝ} (hS : Ops.IsScalar M I)
  (hM : Ops.StdModel u id M) (hCmp : Ops.IsCmp id I) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {n k : ℕ}
  {C κ d : ℝ} {H V : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {e : Fin (n + 1) → ℂ} {r : ℂ}
  {a z cg t sr p0 p1 : ℕ × ℕ} {cv : ℝ} (hH : IsUpperHessenberg H) (hH0 : H ≠ 0) (hV : IsUnit V)
  (hHV : H * V = V * diagonal e) (hκ : pseudoConditionNumber V ≤ κ) (hC : 0 ≤ C) (hd : 0 < d)
  (hr : ‖r‖ ≤ C * specNorm H) (hdist : ∀ (i : Fin (n + 1)), d ≤ ‖e i - r‖) (hk0 : 0 < k)
  (hk : k ≤ n) (hnu : (↑n + 1) * u ≤ 1 / 2500) (hu : 30000 * (↑k + 1) * u ≤ 1)
  (hxu : 300 * (↑n + 1) ^ 2 * u ≤ (8004 * κ)⁻¹ * (d / ((2 + 2 * C) * specNorm H)) ^ k)
  (hA : HoldsMatrix a H m.store) (hz : m.store.readBlock z.1 z.2 2 = some [r.re, r.im])
  (hcg : m.store.get cg.1 cg.2 = some cv) (hrt : t.2 + 2 * ((n + 1) * (n + 1)) ≤ m.store.len t.1)
  (hrsr : sr.2 + 2 * k ≤ m.store.len sr.1) (hrp0 : p0.2 < m.store.len p0.1)
  (hrp1 : p1.2 < m.store.len p1.1)
  (hW :
    (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock sr.1 sr.2 (2 * k) ⊔
            Ops.Store.inBlock p0.1 p0.2 1 ⊔
          Ops.Store.inBlock p1.1 p1.2 1).Disj
      (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock z.1 z.2 2 ⊔
        Ops.Store.inBlock cg.1 cg.2 1))
  (hts :
    Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock sr.1 sr.2 (2 * k)))
  (htp :
    Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock p0.1 p0.2 1))
  (hp1 :
    Ops.Fp.Disj (Ops.Store.inBlock p1.1 p1.2 1)
      (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock p0.1 p0.2 1))
  (hL : Ops.IsIndexLit M I) (hNat : Ops.IsExactNatLit id M (n + 1)) {ns w : ℕ} {lg : ℕ × ℕ}
  {LL : List (Option (List GivensEntry))} (hlog : HoldsSlottedLog lg ns w LL [] m.store)
  (hj : LL.length < ns) (hw : k * n ≤ w) (hlgl : m.Live [lg])
  (hlgb : ∀ b ∈ [a, z, cg, t, sr, p0, p1], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.shTestStep
    (Ops.Env.frame [n + 1, k, w, LL.length] [a, z, cg, t, sr, p0, p1, lg])
    (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock sr.1 sr.2 (2 * k) ⊔
          Ops.Store.inBlock p0.1 p0.2 1 ⊔
        Ops.Store.inBlock p1.1 p1.2 1 ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      m'.pos = m.pos ∧
        ∃ es,
          es.length = k * n ∧
            (∀ x ∈ es, x.1 + 1 < n + 1) ∧
              HoldsSlottedLog lg ns w LL es m'.store ∧
                ∃ H' Rs,
                  IsStableQRChainBy (300 * (↑n + 1) ^ 2 * u) H (List.replicate k r) H' Rs
                      (givensLog (n + 1) es) ∧
                    IsUpperHessenberg H' ∧
                      HoldsMatrix t H' m'.store ∧
                        (∃ tc,
                            m'.store.get p0.1 p0.2 = some tc ∧
                              |tc -
                                    ‖WithLp.toLp 2
                                          (((Polynomial.aeval H) (shiftPoly (List.replicate k r)))⁻¹
                                            (Fin.last n))‖⁻¹| ≤
                                1e-3 *
                                  ‖WithLp.toLp 2
                                        (((Polynomial.aeval H) (shiftPoly (List.replicate k r)))⁻¹
                                          (Fin.last n))‖⁻¹) ∧
                          m'.store.get p1.1 p1.2 = some (ShiftedQR.optimalThresholdWord M H k cv))
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedSh.