NLA-lib Explorer

NLAlib.ShiftedQR.schurDiag_loop_writes

Library · theorem

The diagonal copy of NLAlib.ShiftedQR.schurDiag: from a memory holding \mathbf{T}_\mathbf{b} at the first scratch buffer Lc with room for 2d words at o, the loop writes the diagonal of \mathbf{T}_\mathbf{b} to o; a listing of a spectrum within \beta of that diagonal carries over. A step in the proof of _root_.NLAlib.Schur.RandomSchurLeafContract.randomSmallEigContractAt_schurDiag.

NLAlib.ShiftedQR.schurDiag_loop_writes {O Q : Type} [Ops.Has Ops.ScalarOp O] {Mch : Ops.Machine ℝ}
  {I : Ops.Interp O Q ℝ} (hS : Ops.IsScalar Mch I) {d T Lc : ℕ} {w q o : ℕ × ℕ}
  {B Tb : Matrix (Fin d) (Fin d) ℂ} {β : ℝ} {ev : Fin d → ℂ} (hev : IsEigenvalueListing B ev)
  (hb : ∀ (i : Fin d), ‖Tb i i - ev i‖ ≤ β) {τ : Ops.Tape ℝ} {μ : Ops.Mem ℝ}
  (hlen : List.length μ.store = Lc + 2) (hroomo : o.2 + 2 * d ≤ μ.store.len o.1) (hoL : o.1 < Lc)
  (hTb : HoldsMatrix (Lc, 0) Tb μ.store) :
  Ops.Writes Ops.Mode.total I τ
    (Ops.Stmt.loop (Ops.IExp.var 0)
      ((Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.copy) []
            [{ buf := 3,
                off := Ops.IExp.const 2 * (Ops.IExp.var 6 * Ops.IExp.var 0 + Ops.IExp.var 6) }]
            [{ buf := 2, off := Ops.IExp.var 5 + Ops.IExp.const 2 * Ops.IExp.var 6 }]).seq
        (Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.copy) []
          [{ buf := 3,
              off :=
                Ops.IExp.const 2 * (Ops.IExp.var 6 * Ops.IExp.var 0 + Ops.IExp.var 6) +
                  Ops.IExp.const 1 }]
          [{ buf := 2,
              off := Ops.IExp.var 5 + Ops.IExp.const 2 * Ops.IExp.var 6 + Ops.IExp.const 1 }])))
    { idx := (Ops.Env.frame [d, 12, T] [w, q, o]).idx,
      buf := (Ops.Env.frame [d, 12, T] [w, q, o]).buf ++ List.map (fun x ↦ Lc + x) (List.range 2) }
    (Ops.Store.inBlock o.1 o.2 (2 * d))
    (fun μ' ↦
      ∃ roots ev,
        IsEigenvalueListing B ev ∧
          (∀ (i : Fin d), ‖roots i - ev i‖ ≤ β) ∧ HoldsMatrix o (of fun i x ↦ roots i) μ'.store)
    μ

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedTheorems.