NLA-lib Explorer

NLAlib.HutchPlusPlus.finish_writes

Library ยท theorem

Finish the estimator from its actual prepared basis and probe matrix. Both workspaces are allocated at their source positions and released; no rank assumption is needed. A fragment of NLAlib.HutchPlusPlus.estimateRoutine: run only inside its tree, on its operands and the buffers it allocates.

NLAlib.HutchPlusPlus.finish_writes {๐•œ Op Tst : Type} [RCLike ๐•œ] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] [Ops.Has Ops.StoredOperatorOp Op] [Ops.Has Ops.IndexOp Op]
  {I : Ops.Interp Op Tst ๐•œ} {ฯ„ : Ops.Tape ๐•œ} {dataLength : โ„• โ†’ โ„• โ†’ โ„•}
  {matrix : (m n : โ„•) โ†’ List ๐•œ โ†’ Matrix (Fin m) (Fin n) ๐•œ}
  (hS : Ops.IsScalar Ops.RCLikeBlas.machine I) (hB : Ops.RCLikeBlas.IsExact I)
  (hLit : Ops.IsIndexLit Ops.RCLikeBlas.machine I)
  (hI : Ops.StoredOperator.IsExact dataLength matrix I) {n k ell : โ„•} {data b out : โ„• ร— โ„•}
  {m : Ops.Mem ๐•œ} (as : List ๐•œ) (S : Matrix (Fin n) (Fin k) ๐•œ) (G : Matrix (Fin n) (Fin ell) ๐•œ)
  (hl : m.Live [data, b, out])
  (hAP : Ops.Fp.Apart [data, b, out] [dataLength n n, (k + ell) * n, 1])
  (hA : m.store.readBlock data.1 data.2 (dataLength n n) = some as)
  (hInput :
    m.store.readBlock b.1 b.2 ((k + ell) * n) =
      some
        ((Ops.EntryCodec.scalar ๐•œ).packFinMatrix
          (HutchPlusPlus.basisProbes (gramSchmidtQ (matrix n n as * S)) G)))
  (hb : b.2 + (k + ell) * n โ‰ค m.store.len b.1) (ho : out.2 + 1 โ‰ค m.store.len out.1) :
  Ops.Writes Ops.Mode.total I ฯ„ HutchPlusPlus.finish (Ops.Env.frame [n, k, ell] [data, b, out])
    (Ops.Store.inBlock b.1 b.2 ((k + ell) * n) โŠ” Ops.Store.inBlock out.1 out.2 1)
    (fun m' โ†ฆ
      m'.pos = m.pos โˆง m'.store.readBlock out.1 out.2 1 = some [hutchpp (matrix n n as) S G])
    m

Full source on GitHub

Import NLAlib.Estimation.Trace.HutchPlusPlus.Finish.