mathnet / mathnet-numerics

Math.NET Numerics
http://numerics.mathdotnet.com
MIT License
3.51k stars 898 forks source link

Fails PseudoInvert for a specific simple matrix #1087

Open ibasin opened 3 months ago

ibasin commented 3 months ago

The following code will fail:

var m = M.DenseOfArray(new[,] { { -2f, -2f, -1f }, { -2f, 2f, 1f }, { -1f, -1f, 2f },

}); var pinvM = m.PseudoInverse(); Console.WriteLine(pinvM);

ibasin commented 3 months ago

If in method: MathNet.Numerics.Providers.LinearAlgebra.ManagedLinearAlgebraProvider.SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt) you change double ztest; double test; to float ztest; float test; it will fix the problem!