NLA-lib Explorer

NLAlib.ShiftedQR.copyLastDiagonal_writes

Library · theorem

On any scalar machine, copying a positive-order matrix's last diagonal entry writes its real and imaginary words exactly and preserves every other cell and the tape position. The output has capacity for two words and is disjoint from the complete input matrix. Shared by the trees of NLAlib.ShiftedQR.shqrSmallEigRoutine and NLAlib.SmallEig.smallEigRoutine, on their scratch.

NLAlib.ShiftedQR.copyLastDiagonal_writes {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  {M : Ops.Machine ℝ} {I : Ops.Interp Op Tst ℝ} (hS : Ops.IsScalar M I) {τ : Ops.Tape ℝ}
  {m : Ops.Mem ℝ} {n : ℕ} {w d : ℕ × ℕ} {W : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ}
  (hW : HoldsMatrix w W m.store) (hd : d.2 + 2 ≤ m.store.len d.1)
  (hwd :
    Ops.Fp.Disj (Ops.Store.inBlock w.1 w.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock d.1 d.2 2)) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.copyLastDiagonal (Ops.Env.frame [n + 1] [w, d])
    (Ops.Store.inBlock d.1 d.2 2)
    (fun m' ↦
      m'.pos = m.pos ∧
        m'.store.readBlock d.1 d.2 2 =
          some [(W (Fin.last n) (Fin.last n)).re, (W (Fin.last n) (Fin.last n)).im])
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.SweepOutput.