NLA-lib Explorer

NLAlib.Ops.Examples.push_seq_cgsColCount

Library · theorem

The scalar counts of column j of cgs under sequential summation, by evaluating the push-forward: (2 j + 1) n multiplications, j (n - 1) + j n + (n - 1) additions, j negations, n divisions, one square root, 2 n copies of the vector, and the literals and copies of the j + 1 summations.

NLAlib.Ops.Examples.push_seq_cgsColCount {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] [Ops.Apart Ops.Blas1Op Ops.ScalarOp Op] (n j : ℕ) :
  (Ops.Count.push Ops.Blas.seq.cost) (Ops.Examples.cgsColCount n j) =
    j •
        (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))) +
      (n • Ops.Blas.sc Ops.ScalarOp.copy +
        (j •
            (Ops.Blas.sc Ops.ScalarOp.neg +
              n • (Ops.Blas.sc Ops.ScalarOp.mul + Ops.Blas.sc Ops.ScalarOp.add)) +
          (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) +
                Ops.Blas.sc Ops.ScalarOp.sqrt) +
            (n • Ops.Blas.sc Ops.ScalarOp.div + n • Ops.Blas.sc Ops.ScalarOp.copy))))

Full source on GitHub

Import NLAlib.Ops.Examples.CgsLinked.