NLAlib.Deflation.apply_writes
Library · theorem
Sample, multiply, factor and select columns in explicit workspace: a fragment of NLAlib.Deflation.deflateRoutine, run on the four square scratch buffers that the routine allocates. Every input is read before its output is written. Scratch and output geometry is explicit; the Gaussian distribution is unnecessary for this total word-level computation.
NLAlib.Deflation.apply_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
[Ops.Has Ops.MatrixOp Op] [Ops.Has Ops.SampleOp Op] {M : Ops.Machine K} {I : Ops.Interp Op Tst K}
(hS : Ops.IsScalar M I) (hSample : Ops.IsSample I) {mm : MatMulMap (K × K)} {qr : QRMap (K × K)}
(hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I)
(hQR : Ops.IsMatrixQR (Ops.EntryCodec.pair K) (fun {m n} ↦ qr) I) {tape : Ops.Tape K}
{m : Ops.Mem K} {n rank : ℕ} {p g y q r z : ℕ × ℕ} (P : Matrix (Fin n) (Fin n) (K × K))
(hrank : rank ≤ n) (hl : m.Live [p, g, y, q, r, z]) (hpg : p.1 ≠ g.1) (hqr : q.1 ≠ r.1)
(hqz : q.1 ≠ z.1)
(hP : m.store.readBlock p.1 p.2 (2 * (n * n)) = some ((Ops.EntryCodec.pair K).packFinMatrix P))
(hG : g.2 + 2 * (n * n) ≤ m.store.len g.1) (hY : y.2 + 2 * (n * n) ≤ m.store.len y.1)
(hQ : q.2 + 2 * (n * n) ≤ m.store.len q.1) (hR : r.2 + 2 * (n * n) ≤ m.store.len r.1)
(hZ : z.2 + 2 * (n * rank) ≤ m.store.len z.1) :
Ops.Writes Ops.Mode.total I tape Deflation.apply (Ops.Env.frame [n, rank] [p, g, y, q, r, z])
(Ops.Store.inBlock g.1 g.2 (2 * (n * n)) ⊔
(Ops.Store.inBlock y.1 y.2 (2 * (n * n)) ⊔
(Ops.Store.inBlock q.1 q.2 (2 * (n * n)) ⊔ Ops.Store.inBlock r.1 r.2 (2 * (n * n)) ⊔
Ops.Store.inBlock z.1 z.2 (2 * (n * rank)))))
(fun m' ↦
m'.pos = m.pos + 2 * (n * n) ∧
m'.store.readBlock z.1 z.2 (2 * (n * rank)) =
some
((Ops.EntryCodec.pair K).packFinMatrix
((qr (mm P (Deflation.sampleMatrix n m.pos tape))).1.submatrix id
(Fin.castLE hrank))))
mImport NLAlib.Eigensolvers.Deflation.Execution.