NLA-lib Explorer

NLAlib.ShiftedQR.searchAndCopyWith_writes

Library · theorem

Exact arithmetic

Prepared search and actual copy-back return the exact mathematical strategy step. The registers and trial matrix are fresh implementation workspace, not user input restrictions. A fragment of the exact decoupler NLAlib.ShiftedQR.scalarDecouple, which exact shifted QR (NLAlib.ShiftedQR.deflationRoutine) takes as its decoupler.

NLAlib.ShiftedQR.searchAndCopyWith_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 ℝ}
  (hS : Ops.IsScalar M I) (hE : Ops.ExactModel id M) (hL : Ops.IsIndexLit M I) (hC : Ops.IsCmp id I)
  {F : Ops.Stmt O Q} (hF : ShiftedQR.RitzSearchContract F I) {tape : Ops.Tape ℝ} {μ : Ops.Mem ℝ}
  {n m D : ℕ} {w ss c r z : ℕ × ℕ} {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {τ B θ α γ : ℝ}
  {shifts : List ℂ} (hHess : IsUpperHessenberg H) (hlen : shifts.length = 2 ^ m) (hk : 2 ^ m ≤ n)
  (hτ : 0 ≤ τ) (hDp : 0 < D) (hD : D = ⌈√2 / exceptionalSpacing (2 ^ m) B θ α ((1 - γ) ^ 2)⌉₊)
  (hH : HoldsMatrix w H μ.store) (hSS : HoldsMatrix ss (shiftColumn shifts) μ.store)
  (hCst : μ.store.readBlock c.1 c.2 2 = some [τ ^ 2, (1 - γ) ^ (2 * 2 ^ m)])
  (hRegs :
    μ.store.readBlock r.1 r.2 4 =
      some
        [subdiagNormSqProd (2 ^ m) H, (1 - γ) ^ (2 * 2 ^ m) * subdiagNormSqProd (2 ^ m) H,
          exceptionalRadius (2 ^ m) B θ α (hessenbergPotential (2 ^ m) H), 0])
  (hl : μ.Live [w, ss, c, r, z]) (hr : r.2 + 8 ≤ μ.store.len r.1)
  (hz : z.2 + 2 * ((n + 1) * (n + 1)) ≤ μ.store.len z.1)
  (hFreshR : r.1 ≠ w.1 ∧ r.1 ≠ ss.1 ∧ r.1 ≠ c.1 ∧ r.1 ≠ z.1)
  (hFreshZ : z.1 ≠ w.1 ∧ z.1 ≠ ss.1 ∧ z.1 ≠ c.1) :
  Ops.Writes Ops.Mode.total I tape (ShiftedQR.searchAndCopyWith F)
    (Ops.Env.frame [n + 1, m, 2 ^ m, D] [w, ss, c, r, z, w, z, r])
    (Ops.Store.inBlock w.1 w.2 (2 * ((n + 1) * (n + 1))) ⊔
        Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔
      Ops.Store.inBlock r.1 r.2 8)
    (fun μ' ↦ μ'.pos = μ.pos ∧ HoldsMatrix w (shqrAcceptStep τ B θ α γ m H shifts) μ'.store) μ

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.IterationWords.