NLA-lib Explorer

NLAlib.HutchPlusPlus.applyColumns_writes

Library ยท theorem

A batch of local matrix-vector applications computes a matrix product. Read-only operator data and input columns may share a buffer when their spans satisfy the contract. A fragment of NLAlib.HutchPlusPlus.estimateRoutine: run only inside its tree, on its operands and the buffers it allocates.

NLAlib.HutchPlusPlus.applyColumns_writes {๐•œ Op Tst : Type} [RCLike ๐•œ]
  [Ops.Has Ops.StoredOperatorOp 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) {n k : โ„•} {data x y : โ„• ร— โ„•} (as : List ๐•œ)
  (X : Matrix (Fin n) (Fin k) ๐•œ) (hl : m.Live [data, x, y])
  (hA : m.store.readBlock data.1 data.2 (dataLength n n) = some as)
  (hX : m.store.readBlock x.1 x.2 (k * n) = some ((Ops.EntryCodec.scalar ๐•œ).packFinMatrix X))
  (hYX : Ops.Fp.Disj (Ops.Store.inBlock y.1 y.2 (k * n)) (Ops.Store.inBlock x.1 x.2 (k * n)))
  (hYA :
    Ops.Fp.Disj (Ops.Store.inBlock y.1 y.2 (k * n))
      (Ops.Store.inBlock data.1 data.2 (dataLength n n)))
  (hy : y.2 + k * n โ‰ค m.store.len y.1) :
  Ops.Writes Ops.Mode.total I ฯ„ HutchPlusPlus.applyColumns (Ops.Env.frame [n, k] [data, x, y])
    (Ops.Store.inBlock y.1 y.2 (k * n))
    (fun m' โ†ฆ
      m'.pos = m.pos โˆง
        m'.store.readBlock y.1 y.2 (k * n) =
          some ((Ops.EntryCodec.scalar ๐•œ).packFinMatrix (matrix n n as * X)))
    m

Full source on GitHub

Import NLAlib.Estimation.Trace.HutchPlusPlus.Apply.