This project has moved. For the latest updates, please go here.

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

Mar 21, 2014 at 3:27 PM
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?
Mar 21, 2014 at 3:48 PM
I assume you want the squared L2-norm (which is what Iridium did if I remember correctly).
// straight forward, simply square the L2-norm directly:
var squaredNorm1 = Math.Pow(v.L2Norm(),2);

// alternative using dot product, much shorter and likely also faster:
var squaredNorm2 = v*v;
Mar 21, 2014 at 5:18 PM
Hmmm... There is no such L2Norm() on a vector.
I'm using the latest stable version, not the alpha.
Mar 21, 2014 at 5:25 PM
Ah yes, the norms are one of the improved areas in v3. You can use p-norm with p=2 though: Norm(2). Or of course the dot product.
Marked as answer by stecy on 3/21/2014 at 10:30 AM
Mar 21, 2014 at 5:31 PM
Does V3, even as alpha, usable?
I only use Precision and LinearAlgebra (on double) stuff.
Mar 21, 2014 at 5:44 PM
Edited Mar 21, 2014 at 5:46 PM
We use semantic versioning, so the alpha primarily indicates that the API may still change a bit and you may need to updated your code accordingly (i.e. no compatibility guarantees) - not that the algorithms are broken (at least those that existed before).

However, given that the API has changed quite a bit, it will still be a lot easier to migrate from a v3 alpha to v3 final than upgrading from v2, so I'd recommend to give v3 a trial. Also, until the final release we can still change the API in case you stumble over some bad design choices and give feedback :)
Marked as answer by stecy on 3/21/2014 at 11:21 AM