NLA-lib Explorer

NLAlib.HutchPlusPlus.prepare_writes

Library Β· theorem

The preparation returns the rank-revealing basis and actual untouched probes. Every temporary allocation is cleaned up and both sample windows are identified exactly. A fragment of NLAlib.HutchPlusPlus.estimateRoutine: run only inside its tree, on its operands and the buffers it allocates.

NLAlib.HutchPlusPlus.prepare_writes {π•œ Op Tst : Type} [RCLike π•œ] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] [Ops.Has Ops.CmpTst Tst] [Ops.Has Ops.StoredOperatorOp Op]
  [Ops.Has Ops.SampleOp Op] {I : Ops.Interp Op Tst π•œ} {Ο„ : Ops.Tape π•œ} {m : Ops.Mem π•œ}
  (hS : Ops.IsScalar Ops.RCLikeBlas.machine I) (hB : Ops.RCLikeBlas.IsExact I)
  (hC : Ops.IsCmp (⇑RCLike.re) I) {dataLength : β„• β†’ β„• β†’ β„•}
  {matrix : (m n : β„•) β†’ List π•œ β†’ Matrix (Fin m) (Fin n) π•œ}
  (hI : Ops.StoredOperator.IsExact dataLength matrix I) (hSample : Ops.IsSample I) (stream : β„•)
  {n k ell : β„•} {data b : β„• Γ— β„•} (as : List π•œ) (hl : m.Live [data, b])
  (hA : m.store.readBlock data.1 data.2 (dataLength n n) = some as)
  (hBA :
    Ops.Fp.Disj (Ops.Store.inBlock b.1 b.2 ((k + ell) * n))
      (Ops.Store.inBlock data.1 data.2 (dataLength n n)))
  (hb : b.2 + (k + ell) * n ≀ m.store.len b.1) :
  Ops.Writes Ops.Mode.total I Ο„ (HutchPlusPlus.prepare stream) (Ops.Env.frame [n, k, ell] [data, b])
    (Ops.Store.inBlock b.1 b.2 ((k + ell) * n))
    (fun m' ↦
      m'.pos = m.pos + n * (k + ell) ∧
        m'.store.readBlock b.1 b.2 ((k + ell) * n) =
          some
            ((Ops.EntryCodec.scalar π•œ).packFinMatrix
              (HutchPlusPlus.basisProbes
                (gramSchmidtQ
                  (matrix n n as *
                    (Ops.EntryCodec.scalar π•œ).matrix n k (Ο„.window stream m.pos (n * k))))
                ((Ops.EntryCodec.scalar π•œ).matrix n ell
                  (Ο„.window stream (m.pos + n * k) (n * ell))))))
    m

Full source on GitHub

Import NLAlib.Estimation.Trace.HutchPlusPlus.Prepare.