NLA-lib Explorer

NLAlib.Krylov.CG.Reorth.update_writes

Library · theorem

Exact arithmetic Oracle: matrix–vector product

Exact arithmetic forms the new iterate and raw residual and retains the old squared norm. The three caller buffers are below the three distinct scratch buffers starting at L.

A fragment of NLAlib.Krylov.CG.Reorth.solveRoutine, not a routine: it runs on the scratch of round, and the old squared norm it leaves in the scalar cell t[0] is read by direction.

NLAlib.Krylov.CG.Reorth.update_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] [Ops.Has Ops.OperatorOp Op] {M : Ops.Machine K} {dec : K → ℝ}
  {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) (hM : Ops.ExactModel dec M)
  (hB : Ops.IsExactBlas1 dec (fun x ↦ True) I) {n L : ℕ} {A : Matrix (Fin n) (Fin n) ℝ}
  (hA : Ops.IsExactMatvec dec A I) {τ : Ops.Tape K} {μ : Ops.Mem K} {x r p : ℕ × ℕ}
  {xs rs ps : List K} (hxr : x.1 ≠ r.1) (hxp : x.1 ≠ p.1) (hrp : r.1 ≠ p.1) (hxL : x.1 < L)
  (hrL : r.1 < L) (hpL : p.1 < L) (hl : List.length μ.store = L + 3) (hW : μ.store.len L = n)
  (ht : μ.store.len (L + 2) = 4) (hxz : x.2 + n ≤ μ.store.len x.1) (hrz : r.2 + n ≤ μ.store.len r.1)
  (hxs : μ.store.readBlock x.1 x.2 n = some xs) (hrs : μ.store.readBlock r.1 r.2 n = some rs)
  (hps : μ.store.readBlock p.1 p.2 n = some ps)
  (hdom : Krylov.CG.Nonbreakdown A (Krylov.CG.HSCG.decodedState dec n xs rs ps)) :
  Ops.Writes Ops.Mode.total I τ Krylov.CG.Reorth.update
    (Ops.Env.frame [n] [x, r, p, (L, 0), (L + 2, 0), x, r])
    (Ops.Fp.blocks [x, r, (L, 0), (L + 2, 0)] [n, n, n, 4])
    (fun μ' ↦
      μ'.pos = μ.pos ∧
        ∃ xs' rs' rr,
          μ'.store.readBlock x.1 x.2 n = some xs' ∧
            μ'.store.readBlock r.1 r.2 n = some rs' ∧
              μ'.store.get (L + 2) 0 = some rr ∧
                dec rr = Ops.decv dec n rs ⬝ᵥ Ops.decv dec n rs ∧
                  Ops.decv dec n xs' = (cgStep A (Krylov.CG.HSCG.decodedState dec n xs rs ps)).x ∧
                    Ops.decv dec n rs' = (cgStep A (Krylov.CG.HSCG.decodedState dec n xs rs ps)).r)
    μ

Full source on GitHub

Import NLAlib.Krylov.CG.Reorth.Update.