NLA-lib Explorer

NLAlib.ShiftedQR.stepWithDiag_isStableQRStep

Library · theorem

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

Standard rounding

The rounded single shifted QR step is backward stable by its recorded unitary ([BanksGarzaVargasSrivastava2022, Lemma 3.5], with the error base \|\mathbf{H}\|_2 + \lvert s\rvert for the paper's \|\mathbf{H} - s\|_2, which rounding does not meet, and the constant 300(n+1)^2 for the paper's 32n^{3/2}): on a machine with the standard model at the unit roundoff \boldsymbol{u} \ge 0 with (n+1)\boldsymbol{u} \le 1/2500, from an upper Hessenberg \mathbf{H} of order n + 1 and a shift s, the program stepWithDiag appends n entries e_1, \dots, e_n (planes below n) to the pending slot of the log and stores an \widehat{\mathbf{H}}' and the last diagonal entry of an \widehat{\mathbf{R}} such that (\widehat{\mathbf{H}}', \widehat{\mathbf{R}}) is a backward-stable QR step of (\mathbf{H}, s) by the exact unitary givensLog (n + 1) es of the entries, with error 300(n+1)^2\boldsymbol{u}(\|\mathbf{H}\|_2 + \lvert s\rvert). The planes are written as exact naturals (hNat, up to n_{\max} \ge n). The output matrix is disjoint from the input matrix, the shift and the diagonal pair; the log from all of them.

NLAlib.ShiftedQR.stepWithDiag_isStableQRStep {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.CmpTst Tst] {M : Ops.Machine ℝ} {I : Ops.Interp Op Tst ℝ}
  {u : ℝ} (hS : Ops.IsScalar M I) (hM : Ops.StdModel u id M) (hu : 0 ≤ u) (hCmp : Ops.IsCmp id I)
  (hL : Ops.IsIndexLit M I) {nmax : ℕ} (hNat : Ops.IsExactNatLit id M nmax) {τ : Ops.Tape ℝ}
  {m : Ops.Mem ℝ} {n : ℕ} {a s z dg lg : ℕ × ℕ} {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ}
  {shift : ℂ} (hH : IsUpperHessenberg H) (hnu : (↑n + 1) * u ≤ 1 / 2500) (hn : n ≤ nmax) {ns w : ℕ}
  {L : List (Option (List GivensEntry))} {P : List GivensEntry}
  (hlog : HoldsSlottedLog lg ns w L P m.store) (hj : L.length < ns) (hw : P.length + n ≤ w)
  (hl : m.Live [a, s, z, dg, lg]) (hA : HoldsMatrix a H m.store)
  (hs : m.store.readBlock s.1 s.2 2 = some [shift.re, shift.im])
  (hz : z.2 + 2 * ((n + 1) * (n + 1)) ≤ m.store.len z.1) (hd : dg.2 + 2 ≤ m.store.len dg.1)
  (haz :
    Ops.Fp.Disj (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1)))))
  (hsz :
    Ops.Fp.Disj (Ops.Store.inBlock s.1 s.2 2) (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1)))))
  (hzd :
    Ops.Fp.Disj (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock dg.1 dg.2 2))
  (hlgd :
    Ops.Fp.Disj (Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
      (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock s.1 s.2 2 ⊔
          Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔
        Ops.Store.inBlock dg.1 dg.2 2)) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.stepWithDiag
    (Ops.Env.frame [n + 1, w, L.length, P.length] [a, s, z, dg, lg])
    (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock dg.1 dg.2 2 ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      m'.pos = m.pos ∧
        ∃ es,
          es.length = n ∧
            (∀ e ∈ es, e.1 + 1 < n + 1) ∧
              HoldsSlottedLog lg ns w L (P ++ es) m'.store ∧
                ∃ H' R,
                  IsStableQRStepBy (givensLog (n + 1) es)
                      (300 * (↑n + 1) ^ 2 * u * (specNorm H + ‖shift‖)) H shift H' R ∧
                    HoldsMatrix z H' m'.store ∧
                      m'.store.readBlock dg.1 dg.2 2 =
                        some [(R (Fin.last n) (Fin.last n)).re, (R (Fin.last n) (Fin.last n)).im])
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.StableStep.