2

In the old version (Iridium) there was a method Vector.SquaredNorm() but in the most recent stable version of Math.Net there is none available.

What method should I use?

Stécy
  • 11,951
  • 16
  • 64
  • 89

1 Answers1

1

If you want the squared L2-norm (which is what Iridium did if I remember correctly) you can simply square it yourself:

var squaredNorm1 = Math.Pow(v.L2Norm(),2);

Alternatively you can also use dot product which is a bit shorter (and also faster in case you use native providers and the vectors are very large):

var squaredNorm2 = v*v;
Christoph Rüegg
  • 4,626
  • 1
  • 20
  • 34
  • In v2 L2Norm was not available yet - use `Norm(2)` instead – Christoph Rüegg Mar 21 '14 at 17:27
  • 2
    The reason for using a squared norm is efficiency. Calculating a regular norm involves a square root operation, so SquaredNorm skips that step. So the second suggestion is much preferred. – Alan Baljeu Sep 05 '14 at 14:36