NLA-lib Explorer

NLAlib.Ops.Examples.push_seq_gemmCount

Library · theorem

The scalar counts of gemm under sequential summation: per entry, n multiplications, n - 1 additions, a literal and a copy.

NLAlib.Ops.Examples.push_seq_gemmCount {Op Tst : Type} [Ops.Has Ops.Blas1Op Op]
  [Ops.Has Ops.ScalarOp Op] [Ops.Apart Ops.Blas1Op Ops.ScalarOp Op] (m n p : ℕ) :
  (Ops.Count.push Ops.Blas.seq.cost) (Ops.Examples.gemmCount m n p) =
    (m * p) •
      (n • Ops.Blas.sc Ops.ScalarOp.mul +
        (Ops.Blas.sc (Ops.ScalarOp.lit 0) +
          ((1 - (1 - n)) • Ops.Blas.sc Ops.ScalarOp.copy + (n - 1) • Ops.Blas.sc Ops.ScalarOp.add)))

Full source on GitHub

Import NLAlib.Ops.Examples.Gemm.