Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in assignment to multidimensional arrays #27

Open
Asiek777 opened this issue Aug 15, 2019 · 1 comment
Open

Error in assignment to multidimensional arrays #27

Asiek777 opened this issue Aug 15, 2019 · 1 comment

Comments

@Asiek777
Copy link
Contributor

There's a problem with [] (indexing) operator. Indexing with with one number can be used to read value from the entire table, but it cannot be used to write to multidimensional table. While indexing with 2 or more numbers you can write to any table.
I am not sure, if it is the consequence of C implementation or problem with the wrapper, but this behavior is very unintuitive.

Checked on CPU and OpenCL Backend.
I'll try to fix it on my own
There's an example of the problem

    ArrayFire.Array A1D = Data.CreateArray(new int[] { 1, 2, 4 });
    A1D[1] = Data.CreateArray(new int[] { 100 });
    Util.Print(A1D, "A1");

    A2D[0, 0] = Data.CreateArray(new int[] { 11 });
    A2D[1] = Data.CreateArray(new int[] { 100 });
    Util.Print(A2D, "A");

   A3D[1,1,1] = Data.CreateArray(new int[] { 100 });
   A3D[0, 1] = Data.CreateArray(new int[] { 100 });
   A3D[0] = Data.CreateArray(new int[] { 100 });
   Util.Print(A3D[1,1], "A3D");

Generates the output

A1D
[3 1 1 1]
         1
       100
         4

A2D
[3 3 1 1]
       100         -1          4
         2          2          2
         4          0          3

A3D
[2 2 2 1]
         1        100
         2         -1

         2          4
         0        100
@9prady9
Copy link
Member

9prady9 commented Aug 20, 2019

I wasn't not able to reproduce this in upstream. @royalstream @Oceania2018 Can one of you please verify if this is from the wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants