[vector]: Unslice - modification of the argument vector

Deshpande, Vivek R vivek.r.deshpande at intel.com
Thu Sep 26 22:22:38 UTC 2019


Hi

I have been experimenting with unslice(int origin, vector w, int part) version.
I noticed that the vector w gets modified after the execution of the API in the Java implementation.

This stems from usage of getElements() in unslicTemplate() and the res[] array points to the same array in the w vector.
The line System.arraycopy() causes the actual overwriting.

The code I tried is given below: (Here the values of ev vector are modified after execution of unslice method.)
            IntVector dv = IntVector.fromArray(SPECIES1, d, i);
            IntVector ev = IntVector.fromArray(SPECIES1, e, i);
            IntVector dv_v2 = dv.unslice(2, ev, 1);
            dv_v2.intoArray(f, i);

Regards,
Vivek


More information about the panama-dev mailing list