NLA-lib Explorer

NLAlib.ShiftedQR.stepWithDiagInPlace_isStableQRStep

Library · theorem

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

Standard rounding

The rounded single shifted QR step in place 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 and the constant 300(n+1)^2 for the paper's 32n^{3/2}): NLAlib.ShiftedQR.stepWithDiag_isStableQRStep for stepWithDiagInPlace, which replaces an upper Hessenberg \mathbf{H} by the step. The scratch matrix is disjoint from the matrix, the shift and the diagonal pair; the matrix is disjoint from the pair; the log from all of them.

NLAlib.ShiftedQR.stepWithDiagInPlace_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 t 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, t, dg, lg]) (hA : HoldsMatrix a H m.store)
  (hs : m.store.readBlock s.1 s.2 2 = some [shift.re, shift.im])
  (ht : t.2 + 2 * ((n + 1) * (n + 1)) ≤ m.store.len t.1) (hd : dg.2 + 2 ≤ m.store.len dg.1)
  (hat :
    Ops.Fp.Disj (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1)))))
  (hst :
    Ops.Fp.Disj (Ops.Store.inBlock s.1 s.2 2) (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1)))))
  (htd :
    Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock dg.1 dg.2 2))
  (had :
    Ops.Fp.Disj (Ops.Store.inBlock a.1 a.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 t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔
        Ops.Store.inBlock dg.1 dg.2 2)) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.stepWithDiagInPlace
    (Ops.Env.frame [n + 1, w, L.length, P.length] [a, s, t, a, dg, lg])
    (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔
          Ops.Store.inBlock t.1 t.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 a 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.