0

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?

4

1 回答 1

1

L2Norm仅在 v3 中可用:

using MathNet.Numerics.LinearAlgebra;
Vector<double>.Build.Random(10).L2Norm();

在 v2 中,您可以使用Normp=2 作为参数的函数(也可以在 v3 中使用):

using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Distributions;
DenseVector.CreateRandom(10, new Normal()).Norm(2);
于 2014-06-20T23:35:45.243 回答