NLAlib.Krylov.Lanczos.advance_writes
Library · theorem
Exact arithmetic Oracle: matrix–vector product
One complete round succeeds for readable inputs and initialized zero next outputs. Its actual readback exposes the raw residual, normalized direction, and squared-norm guard.
A fragment of NLAlib.Krylov.Lanczos.solveRoutine: one round of its loop, on the scratch the solver allocates and the columns of V and C at the round index.
NLAlib.Krylov.Lanczos.advance_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
[Ops.Has Ops.Blas1Op Op] [Ops.Has Ops.OperatorOp Op] [Ops.Has Ops.CmpTst Tst] {M : Ops.Machine K}
{dec : K → ℝ} {n cap j L B V C bo vo co : ℕ} {A : Matrix (Fin n) (Fin n) ℝ}
{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) (hA : Ops.IsExactMatvec dec A I)
(hCmp : Ops.IsCmp dec I) {τ : Ops.Tape K} {μ : Ops.Mem K} {ps qs next : List K} {β β₀ : K}
(hVL : V < L) (hCL : C < L) (hVC : V ≠ C) (hlen : List.length μ.store = L + 3)
(hp : μ.store.len L = n) (hw : μ.store.len (L + 1) = n) (ht : μ.store.len (L + 2) = 2)
(ha : co + j < μ.store.len C) (hb : co + cap + j + 1 < μ.store.len C)
(hnroom : vo + (j + 1) * n + n ≤ μ.store.len V) (hps : μ.store.readBlock L 0 n = some ps)
(hqs : μ.store.readBlock V (vo + j * n) n = some qs) (hβ : μ.store.get C (co + cap + j) = some β)
(hnext : μ.store.readBlock V (vo + (j + 1) * n) n = some next)
(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.advance
{ idx := [n, cap, bo, vo, co, j], buf := [B, V, C, L, L + 1, L + 2] }
(Krylov.Lanczos.advanceFp n cap j L (V, vo) (C, co))
(fun μ' ↦
μ'.pos = μ.pos ∧
∃ raw ys α β' σ,
μ'.store.readBlock L 0 n = some qs ∧
μ'.store.readBlock V (vo + (j + 1) * n) n = some ys ∧
μ'.store.get C (co + j) = some α ∧
μ'.store.get C (co + cap + j + 1) = some β' ∧
μ'.store.get (L + 2) 0 = some σ ∧
dec α =
lanczosAlpha A
{ prev := Ops.decv dec n ps, cur := Ops.decv dec n qs, beta := dec β } ∧
Ops.decv dec n raw =
A *ᵥ Ops.decv dec n qs - dec β • Ops.decv dec n ps -
dec α • Ops.decv dec n qs ∧
Ops.decv dec n ys =
‖WithLp.toLp 2 (Ops.decv dec n raw)‖⁻¹ • Ops.decv dec n raw ∧
dec β' = ‖WithLp.toLp 2 (Ops.decv dec n raw)‖ ∧
dec σ = Ops.decv dec n raw ⬝ᵥ Ops.decv dec n raw)
μImport NLAlib.Krylov.Lanczos.Advance.