Computator.NET icon indicating copy to clipboard operation
Computator.NET copied to clipboard

Lack of implicit conversion from MathNet.Numerics.LinearAlgebra.Matrix<double> to MathNet.Numerics.LinearAlgebra.Matrix<System.Numerics.Complex> causes TSL errors

Open PawelTroka opened this issue 8 years ago • 2 comments

See #https://github.com/mathnet/mathnet-numerics/issues/304 Lack of this implicit conversion causes below TSL code to not run properly: Example below code will throw error:

var n = 5;

var m1 = matrix<real>(n,n);
var m2 = matrix<complex>(n,n);

writeln(m1+m2);

image

Another example where it will fail:

var m = sqrt(-1)·matrix({{1,0}});

PawelTroka avatar Jan 15 '17 22:01 PawelTroka

Do you work with the generic base types (Matrix<T>, Vector<T>) or with the explicit types in the sub-namespaces? It seems to me we should rather add conversion on the base types (which essentially call ToComplex etc.) rather than on the explicit types.

cdrnet avatar Jan 16 '17 08:01 cdrnet

@cdrnet Yeah, you are right - sorry I missed that. We only need implicit conversion on the base types.

PawelTroka avatar Jan 16 '17 14:01 PawelTroka