Closed Sullivanecidi closed 4 years ago
No builtin way to do that: heres a snippet that should work for your case
unsafe double[,] To2DArray(NDArray nd)
{
var ret = new double[nd.shape[0], nd.shape[1]];
fixed (double* dst = ret)
Unsafe.CopyBlock(dst, nd.Unsafe.Address, (uint)(nd.size * sizeof(double)));
return ret;
}
Hello Again! Last time I asked that: how to convert a NDArray to a list? It can be implemented just as ToArray(). So, how about a matrix to an array? Say matrix[4,5] to double[,]?