NLA-lib Explorer

NLAlib.Sign.step_writes

Library · theorem

One step writes exactly the existing rounded Newton–Schulz matrix. Its cached square is of this same actual input matrix. All four supplied regions are disjoint; the temporary scalar need not be initialized. Numerical accuracy is a separate property of the machine and product. A fragment of NLAlib.Sign.signRoutine.

NLAlib.Sign.step_writes {K Op Tst Su Sg : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.MatrixOp Op] {M : Ops.Machine K} {dec : K → ℝ} {mm : MatMulMap (K × K)}
  {qr : QRMap (K × K)} {unif : K → Su → K} {normal : Sg → K × K} {I : Ops.Interp Op Tst K}
  (hS : Ops.IsScalar M I) (hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I)
  {τ : Ops.Tape K} {n : ℕ} (A : Matrix (Fin n) (Fin n) (K × K)) {x w v c : ℕ × ℕ} {m : Ops.Mem K}
  (hl : m.Live [x, w, v, c])
  (hAP : Ops.Fp.Apart [x, w, v, c] [2 * (n * n), 2 * (n * n), 2 * (n * n), 1])
  (hX : m.store.readBlock x.1 x.2 (2 * (n * n)) = some ((Ops.EntryCodec.pair K).packFinMatrix A))
  (hW :
    m.store.readBlock w.1 w.2 (2 * (n * n)) = some ((Ops.EntryCodec.pair K).packFinMatrix (mm A A)))
  (hx : x.2 + 2 * (n * n) ≤ m.store.len x.1) (hw : w.2 + 2 * (n * n) ≤ m.store.len w.1)
  (hv : v.2 + 2 * (n * n) ≤ m.store.len v.1) (hc : c.2 < m.store.len c.1) :
  Ops.Writes Ops.Mode.total I τ (Sign.step (Ops.Has.inj Ops.MatrixOp.mul))
    (Ops.Env.frame [n] [x, w, v, c, x, w, v, c])
    (Ops.Store.inBlock x.1 x.2 (2 * (n * n)) ⊔ Ops.Store.inBlock w.1 w.2 (2 * (n * n)) ⊔
        Ops.Store.inBlock v.1 v.2 (2 * (n * n)) ⊔
      Ops.Store.inBlock c.1 c.2 1)
    (fun μ ↦
      μ.pos = m.pos ∧
        μ.store.readBlock x.1 x.2 (2 * (n * n)) =
          some
            ((Ops.EntryCodec.pair K).packFinMatrix
              (newtonSchulzRounded
                (M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) unif normal) A)))
    m

Full source on GitHub

Import NLAlib.Eigensolvers.Sign.Step.