SciSharp/Numpy.NET

Unable to cast System.Double[][] to NDarray

Pandath opened this issue · 2 comments

I wrote code like this:
var arr0 = np.array(new double[][] { new double[] { 1,2},new double[] { 3,4} });
if i run my program, it shows something like:"System.InvalidOperationException:“Unable to cast System.Double[][] to NDarray”"
And if i wrote code like:
var arr0 = np.array(new double[] { 1, 2 }, new double[] { 3, 4 });
erros goes like :"Type 'double[]' must be a non-nullable value to be used as a generic type or parameter 'T' in method 'np.array(params T[])"
"
So, what am i supposed to do to cast System.Double[][] to NDarray in one sentence of code, instead of Nested loops.

If you can, please use double[,] instead of double[][], the latter are inefficient and not supported. var arr0 = np.array(new double[,] { { 1,2}, { 3,4} }); should work.

If you can, please use double[,] instead of double[][], the latter are inefficient and not supported. var arr0 = np.array(new double[,] { { 1,2}, { 3,4} }); should work.

Thank you so much, Mr. henon, you just SAVE MY DAY.