Is there a method in recent Math.Net to return the SquaredNorm of a vector?

StackOverflow https://stackoverflow.com/questions/22562844

  •  18-06-2023
  •  | 
  •  

質問

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?

役に立ちましたか?

解決

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;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top