Reputation: 2675
I'm trying to get the magnitude of a vector and I tried using the L2Norm()
method but there was a red line under it stating that MathNet.Numerics.LinearAlgebra.Double.Vector
does not contain a definition for L2Norm
and no extension method L2Norm
accepting a first argument of type MathNet.Numerics.LinearAlgebra.Double.Vector
could be found (are you missing a using directive or an assembly reference?'
I put,
using MathNet.Numerics;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
At the top so I'm not sure why it's still showing an error. Any ideas on what the issue might be?
Upvotes: 0
Views: 2458
Reputation: 4736
L2Norm
is only available in v3:
using MathNet.Numerics.LinearAlgebra;
Vector<double>.Build.Random(10).L2Norm();
In v2 you can use the Norm
function (which is available in v3 as well) with p=2 as argument:
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Distributions;
DenseVector.CreateRandom(10, new Normal()).Norm(2);
Upvotes: 1