NLA-lib Explorer

NLAlib.Krylov.Lanczos.Reorth.saveAndNormalize_writes

Library · theorem

Exact arithmetic

Saving the previous vector and guarded normalization are total, including zero residual.

A fragment of NLAlib.Krylov.Lanczos.Reorth.solveRoutine: the save and normalization of one round, on the scratch the solver allocates and the columns at the round index.

NLAlib.Krylov.Lanczos.Reorth.saveAndNormalize_writes {K Op Tst : Type} [Inhabited K]
  [Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.Blas1Op Op] [Ops.Has Ops.CmpTst Tst] {M : Ops.Machine K}
  {dec : K → ℝ} {n cap j L B V C bo vo co : ℕ} {I : Ops.Interp Op Tst K} {ok : ℕ → Prop}
  (hS : Ops.IsScalar M I) (hM : Ops.ExactModel dec M) (hB : Ops.IsExactBlas1 dec ok I) (hok : ok n)
  (hCmp : Ops.IsCmp dec I) {τ : Ops.Tape K} {μ : Ops.Mem K} {qs reduced next : List K} {β₀ : K}
  (hVL : V < L) (hCL : C < L) (hVC : V ≠ C) (hlen : List.length μ.store = L + 3)
  (hp : μ.store.len L = n) (ht : μ.store.len (L + 2) = 2) (hroom : co + cap + j + 1 < μ.store.len C)
  (hqs : μ.store.readBlock V (vo + j * n) n = some qs)
  (hreduced : μ.store.readBlock (L + 1) 0 n = some reduced)
  (hnext : μ.store.readBlock V (vo + (j + 1) * n) n = some next)
  (hnroom : vo + (j + 1) * n + n ≤ μ.store.len V) (hβ₀ : μ.store.get C (co + cap + j + 1) = some β₀)
  (hnextzero : Ops.decv dec n next = 0) (hβzero : dec β₀ = 0) :
  Ops.Writes Ops.Mode.total I τ Krylov.Lanczos.Reorth.saveAndNormalize
    { idx := [n, cap, bo, vo, co, j], buf := [B, V, C, L, L + 1, L + 2] }
    (Ops.Fp.blocks [(L, 0), (L + 2, 0), (C, co + cap + j + 1), (V, vo + (j + 1) * n)] [n, 2, 1, n])
    (fun μ' ↦
      μ'.pos = μ.pos ∧
        ∃ ys β',
          μ'.store.readBlock L 0 n = some qs ∧
            μ'.store.readBlock V (vo + (j + 1) * n) n = some ys ∧
              μ'.store.get C (co + cap + j + 1) = some β' ∧
                Ops.decv dec n ys =
                    ‖WithLp.toLp 2 (Ops.decv dec n reduced)‖⁻¹ • Ops.decv dec n reduced ∧
                  dec β' = ‖WithLp.toLp 2 (Ops.decv dec n reduced)‖ ∧
                    ∃ σ,
                      μ'.store.get (L + 2) 0 = some σ ∧
                        dec σ = Ops.decv dec n reduced ⬝ᵥ Ops.decv dec n reduced)
    μ

Full source on GitHub

Import NLAlib.Krylov.Lanczos.Reorth.Advance.