-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Description
Hello,
I am facing a problem with getting the values back from an NDarray into a c# array. I can manipulate the NDarrays entirely satisfactory, but GetData<>() method returns me values as if they belonged to an original, continuous array. Let me demonstrate:
[Test]
public void TestNDarray()
{
var n = np.array(new float[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } });
var row0 = n[0]; //extract 1st row
var row0Data = row0.GetData<float>(); //this is correct - {1,2,3}
var col1 = n[":,1"]; //extract 1st column - NDarray is [2 5 8] as expected
var col1Data = col1.GetData();//this is wrong - {2,3,4}
}
I dug a bit into the code of public T[] GetData<T>()
and it does check whether the array is contiguous... Maybe the mistake is there? But alas, col1
does correctly indicate that it is not a contiguous array - so GetData()
should take that into account?
Has anyone faced a similar issue? I am really stuck at this point - I have tried everything I can think of...
Thanks
Dmitry
Metadata
Metadata
Assignees
Labels
No labels