NLA-lib Explorer

NLAlib.HutchPlusPlus.sketch_writes

Library ยท theorem

Draw and apply a sketch, retaining its exact tape window and removing its scratch. The statement includes zero dimensions and does not assume sample independence. A fragment of NLAlib.HutchPlusPlus.estimateRoutine: run only inside its tree, on its operands and the buffers it allocates.

NLAlib.HutchPlusPlus.sketch_writes {๐•œ Op Tst : Type} [RCLike ๐•œ] [Ops.Has Ops.StoredOperatorOp Op]
  [Ops.Has Ops.SampleOp Op] {I : Ops.Interp Op Tst ๐•œ} {ฯ„ : Ops.Tape ๐•œ} {m : Ops.Mem ๐•œ}
  {dataLength : โ„• โ†’ โ„• โ†’ โ„•} {matrix : (m n : โ„•) โ†’ List ๐•œ โ†’ Matrix (Fin m) (Fin n) ๐•œ}
  (hI : Ops.StoredOperator.IsExact dataLength matrix I) (hSample : Ops.IsSample I) (stream : โ„•)
  {n k : โ„•} {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 * n))
      (Ops.Store.inBlock data.1 data.2 (dataLength n n)))
  (hb : b.2 + k * n โ‰ค m.store.len b.1) :
  Ops.Writes Ops.Mode.total I ฯ„ (HutchPlusPlus.sketch stream) (Ops.Env.frame [n, k] [data, b])
    (Ops.Store.inBlock b.1 b.2 (k * n))
    (fun m' โ†ฆ
      m'.pos = m.pos + n * k โˆง
        m'.store.readBlock b.1 b.2 (k * n) =
          some
            ((Ops.EntryCodec.scalar ๐•œ).packFinMatrix
              (matrix n n as *
                (Ops.EntryCodec.scalar ๐•œ).matrix n k (ฯ„.window stream m.pos (n * k)))))
    m

Full source on GitHub

Import NLAlib.Estimation.Trace.HutchPlusPlus.Sketch.