NLA-lib Explorer

NLAlib.Krylov.Lanczos.Reorth.Rounded.saveAndNormalize_writes

Library · theorem

Standard rounding Relative-error BLAS

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.Rounded.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} {u : ℝ}
  {ε : Ops.Blas1Err} (hS : Ops.IsScalar M I) (hM : Ops.StdModel u dec M)
  (hB : Ops.IsBlas1 dec ε ok I) (hok : ok n) (hCmp : Ops.IsCmp dec I) (hu : u < 1)
  (hd : ε.dot n < 1) {τ : 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.IsNrm2Err dec (ε.dot n) u n (Ops.vec reduced) β' ∧
                  Ops.IsScalErr dec ε.scal n β' (Ops.vec reduced) (Ops.vec ys) ∧
                    (Ops.decv dec n reduced = 0 → Ops.decv dec n ys = 0) ∧
                      ∃ σ,
                        μ'.store.get (L + 2) 0 = some σ ∧
                          Ops.IsDotErr dec (ε.dot n) n (Ops.vec reduced) (Ops.vec reduced) σ)
    μ

Full source on GitHub

Import NLAlib.Krylov.Lanczos.Reorth.Rounded.Advance.