Can custom numerics types be used in Matrix Solvers in mathdotnet?

(Leandro Alsina) #1

Using MathNet Numerics in C#. I want to solve a Linear Equation system, with my own numeric type. I created ComplexDecimal, it is for complex numbers, but internally it uses decimal type for both real and imag parts. Because decimal type has better precision that double, although lesser exponent range.

I’m using nuget package MathNet.Numerics 4.7.0

var currentMatrix = CreateMatrix.Dense<ComplexDecimal>(QuantityOfNodes, QuantityOfNodes);
var currentVector = CreateVector.Dense<ComplexDecimal>(QuantityOfNodes);

Exceptions arise from depths of hell: ‘MathNet.Numerics.LinearAlgebra.Matrix`1’ threw an exception.’ NotSupportedException: Matrices and vectors of type ‘ComplexDecimal’ are not supported. Only Double, Single, Complex or Complex32 are supported at this point.

Can this math library be used with custom data types?, how? what can I do?