NLA-lib Explorer

NLAlib.CGS2.addRows_writes

Library · theorem

The loop that adds the coefficients h₂ of the second pass, in the scratch, to the coefficients h₁ of the first, in column c of the coefficient block: the first k + c rows of that column then hold the machine sums, and nothing else is written. A fragment of NLAlib.CGS2.cgs2ExtendRoutine.

NLAlib.CGS2.addRows_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  {M : Ops.Machine K} {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) {τ' : Ops.Tape K}
  {n k b c : ℕ} {Q W C : ℕ × ℕ} {hb tb : ℕ} {m : Ops.Mem K} {h₁ h₂ : List K}
  (hC : C.1 < List.length m.store) (hh : hb < List.length m.store) (hCh : C.1 < hb)
  (hroom : C.2 + c * (k + b) + (k + c) ≤ m.store.len C.1)
  (h1 : m.store.readBlock C.1 (C.2 + c * (k + b)) (k + c) = some h₁)
  (h2 : m.store.readBlock hb 0 (k + c) = some h₂) :
  Ops.Writes Ops.Mode.total I τ'
    (Ops.Stmt.loop (Ops.IExp.var 1 + Ops.IExp.var 8)
      (Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.add) []
        [{ buf := 4,
            off :=
              Ops.IExp.var 7 + Ops.IExp.var 8 * (Ops.IExp.var 1 + Ops.IExp.var 2) +
                Ops.IExp.var 9 },
          { buf := 5, off := Ops.IExp.var 9 }]
        [{ buf := 4,
            off :=
              Ops.IExp.var 7 + Ops.IExp.var 8 * (Ops.IExp.var 1 + Ops.IExp.var 2) +
                Ops.IExp.var 9 }]))
    (CGS2.colEnv n k b c Q W C hb tb) (Ops.Store.inBlock C.1 (C.2 + c * (k + b)) (k + c))
    (fun m' ↦
      (m'.store.HoldsVec C.1 (C.2 + c * (k + b)) (k + c) fun i ↦
          M.add (Ops.vec h₁ i) (Ops.vec h₂ i)) ∧
        m'.pos = m.pos)
    m

Full source on GitHub

Import NLAlib.Krylov.Orthogonalization.CGS2.ExtendColumn.