NLA-lib Explorer

NLAlib.Ops.RCLikeScalar.stmtCost_nrm2

Library · theorem

The Euclidean norm uses the streamed Hermitian dot and one scalar square root.

NLAlib.Ops.RCLikeScalar.stmtCost_nrm2 {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.StarOp Op] (n x out : ℕ) :
  Ops.stmtCost Ops.RCLikeScalar.nrm2 [n, x, out] =
    Ops.Count.one (Ops.Has.inj (Ops.ScalarOp.lit 0)) [] +
        n •
          (Ops.Count.one (Ops.Has.inj Ops.StarOp.conj) [] +
              Ops.Count.one (Ops.Has.inj Ops.ScalarOp.mul) [] +
            Ops.Count.one (Ops.Has.inj Ops.ScalarOp.add) []) +
      Ops.Count.one (Ops.Has.inj Ops.ScalarOp.sqrt) []

Full source on GitHub

Import NLAlib.Ops.Profiles.RCLikeScalar.