NLA-lib Explorer

NLAlib.ShiftedQR.tryCandidate_writes

Library · theorem

Exact arithmetic

The stored first-accepted-candidate invariant extends by one candidate. Rejected prefixes execute the scalar trial; accepted prefixes execute the actual skip branch. A fragment of the exact decoupler NLAlib.ShiftedQR.scalarDecouple, which exact shifted QR (NLAlib.ShiftedQR.deflationRoutine) takes as its decoupler.

NLAlib.ShiftedQR.tryCandidate_writes {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 ℝ}
  (hS : Ops.IsScalar M I) (hE : Ops.ExactModel id M) (hL : Ops.IsIndexLit M I) (hC : Ops.IsCmp id I)
  {τp : Ops.Tape ℝ} {m : Ops.Mem ℝ} {n k : ℕ} {a s t target z f : ℕ × ℕ}
  {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {shift : ℂ} {τ γ : ℝ} {ss : List ℂ} (hk : k ≤ n)
  (hτ : 0 ≤ τ) (hH : HoldsMatrix a H m.store)
  (hs : m.store.readBlock s.1 s.2 2 = some [shift.re, shift.im])
  (ht : m.store.get t.1 t.2 = some (τ ^ 2))
  (hTarget : m.store.get target.1 target.2 = some ((1 - γ) ^ (2 * k) * subdiagNormSqProd k H))
  (hstate : ShiftedQR.CandidateHolds τ γ k H ss z f m.store) (hl : m.Live [a, s, t, target, z, f])
  (hz : z.2 + 2 * ((n + 1) * (n + 1)) ≤ m.store.len z.1) (hf : f.2 < m.store.len f.1)
  (hzf :
    Ops.Fp.Disj (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1)))) (Ops.Store.inBlock f.1 f.2 1))
  (hsep :
    (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock f.1 f.2 1).Disj
      (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 1 ⊔
        Ops.Store.inBlock target.1 target.2 1)) :
  Ops.Writes Ops.Mode.total I τp ShiftedQR.tryCandidate
    (Ops.Env.frame [n + 1, k] [a, s, t, target, f, z, f])
    (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock f.1 f.2 1)
    (fun m' ↦
      m'.pos = m.pos ∧
        ShiftedQR.CandidateHolds τ γ k H (ss ++ [shift]) z f m'.store ∧
          HoldsMatrix z
            (multiShiftedQRStep H
              (List.replicate k
                ((List.find? (fun s ↦ decide (IsShiftAccept τ γ k H s)) ss).getD shift)))
            m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.Search.