NLA-lib Explorer

NLAlib.Ops.ColumnProducts.sum_writes

Library ยท theorem

Sum the actual column inner products with one caller-owned temporary cell. Readable inputs are retained through the two-cell output footprint, including shared buffers. Shared by the trees of NLAlib.HutchPlusPlus.projectProbes, NLAlib.HutchPlusPlus.accumulate, NLAlib.CGS2.cgs2ExtendFinish and 17 more.

NLAlib.Ops.ColumnProducts.sum_writes {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] {๐•œ : Type} [RCLike ๐•œ] {I : Ops.Interp Op Tst ๐•œ} {ฯ„ : Ops.Tape ๐•œ}
  {m : Ops.Mem ๐•œ} (hS : Ops.IsScalar Ops.RCLikeBlas.machine I) (hB : Ops.RCLikeBlas.IsExact I)
  {n k : โ„•} {x y t out : โ„• ร— โ„•} (xs ys : โ„• โ†’ List ๐•œ) (hl : m.Live [x, y, t, out])
  (hX : โˆ€ j < k, m.store.readBlock x.1 (x.2 + n * j) n = some (xs j))
  (hY : โˆ€ j < k, m.store.readBlock y.1 (y.2 + n * j) n = some (ys j))
  (hDX :
    โˆ€ j < k,
      (Ops.Store.inBlock t.1 t.2 1 โŠ” Ops.Store.inBlock out.1 out.2 1).Disj
        (Ops.Store.inBlock x.1 (x.2 + n * j) n))
  (hDY :
    โˆ€ j < k,
      (Ops.Store.inBlock t.1 t.2 1 โŠ” Ops.Store.inBlock out.1 out.2 1).Disj
        (Ops.Store.inBlock y.1 (y.2 + n * j) n))
  (hTO : Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 1) (Ops.Store.inBlock out.1 out.2 1))
  (ht : t.2 + 1 โ‰ค m.store.len t.1) (ho : out.2 + 1 โ‰ค m.store.len out.1) :
  Ops.Writes Ops.Mode.total I ฯ„ Ops.ColumnProducts.sum (Ops.Env.frame [n, k] [x, y, t, out])
    (Ops.Store.inBlock t.1 t.2 1 โŠ” Ops.Store.inBlock out.1 out.2 1)
    (fun m' โ†ฆ
      m'.pos = m.pos โˆง
        m'.store.readBlock out.1 out.2 1 =
          some [โˆ‘ j โˆˆ Finset.range k, Ops.RCLikeBlas.dot n (xs j) (ys j)])
    m

Full source on GitHub

Import NLAlib.Ops.Blas.ColumnProducts.