NLA-lib Explorer

NLAlib.ShiftedQR.optimalTestWithScratch_writes_word

Library · theorem

Optimal with scratch in fresh buffers L, …, L + 7 (offset 0, as an allocation gives them) on any scalar machine with exact comparisons: it stores NLAlib.ShiftedQR.optimalTestWord in F and writes only F and the scratch. A fragment of the tree NLAlib.ShiftedQR.optimalTest.

NLAlib.ShiftedQR.optimalTestWithScratch_writes_word {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.CmpTst Tst] {M : Ops.Machine ℝ} {I : Ops.Interp Op Tst ℝ} (hS : Ops.IsScalar M I)
  (hC : Ops.IsCmp id I) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {n L : ℕ} {a s c f : ℕ × ℕ}
  {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {ss : List ℂ} {cv : ℝ} (hk : ss.length ≤ n)
  (hH : HoldsMatrix a H m.store)
  (hs : m.store.readBlock s.1 s.2 (2 * ss.length) = some (List.flatMap (fun z ↦ [z.re, z.im]) ss))
  (hc : m.store.get c.1 c.2 = some cv) (hf : f.2 < m.store.len f.1) (ha : a.1 < L) (hsL : s.1 < L)
  (hcL : c.1 < L) (hfL : f.1 < L) (hlen : List.length m.store = L + 8)
  (hv : m.store.len L = 2 * (n + 1)) (hy : m.store.len (L + 1) = 2 * (n + 1))
  (hw : m.store.len (L + 2) = 2 * ((n + 1) * (n + 1))) (ho : m.store.len (L + 3) = 2)
  (ht : m.store.len (L + 4) = 2) (hz : m.store.len (L + 5) = 2) (hu : m.store.len (L + 6) = 3)
  (hq : m.store.len (L + 7) = 2)
  (has :
    Ops.Fp.Disj (Ops.Store.inBlock f.1 f.2 1)
      (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔
          Ops.Store.inBlock s.1 s.2 (2 * ss.length) ⊔
        Ops.Store.inBlock c.1 c.2 1)) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.optimalTestWithScratch
    (Ops.Env.frame [n + 1, ss.length]
      [a, s, c, (L, 0), (L + 1, 0), (L + 2, 0), (L + 3, 0), (L + 4, 0), (L + 5, 0), (L + 6, 0),
        (L + 7, 0), f])
    (Ops.Store.inBlock f.1 f.2 1 ⊔ Ops.Fp.above L)
    (fun m' ↦ m'.pos = m.pos ∧ m'.store.get f.1 f.2 = some (ShiftedQR.optimalTestWord M H ss cv)) m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedRitz.