1

This is the example for LU. What could be wrong ?

var maxVertexIndex = vertices.Keys.Max(i => i);
var L = new SparseMatrix(maxVertexIndex, maxVertexIndex); 
//(fill L, code omitted)
var rhs = MathNet.Numerics.LinearAlgebra.Vector<float>.Build.SparseOfIndexed(maxVertexIndex, vertices.Values.Select(v => (v.Index, v.Position3d)));
var result = solver.Solve(rhs); //Crash here
System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
    at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at MathNet.Numerics.LinearAlgebra.Storage.SparseVectorStorage`1.InsertAtIndexUnchecked(Int32 itemIndex, Int32 index, T value)
   at MathNet.Numerics.LinearAlgebra.Storage.SparseVectorStorage`1.At(Int32 index, T value)
   at MathNet.Numerics.LinearAlgebra.Storage.VectorStorage`1.set_Item(Int32 index, T value)
   at MathNet.Numerics.LinearAlgebra.Single.Factorization.UserLU.Solve(Vector`1 input, Vector`1 result)
   at MathNet.Numerics.LinearAlgebra.Factorization.LU`1.Solve(Vector`1 input)

I had a crash in SVD too 9 months ago. I have rewritten the SVD alg from scratch and it works as expected. So am I doing something wrong or is MathNet unreliable ?

Softlion
  • 12,281
  • 11
  • 58
  • 88

0 Answers0