In the following code, indexing array a with a(-1) and with another array that contains a -1 do not produce the same result. When indexing with a -1, the last element of the array is returned as expected. However, if the same array is indexed with another array containing a -1 the first element of the array is indexed.
Expected behavior
a(-1) should be equivalent to a(d)
Current behavior
a(d) indexes from the beginning of the array rather than the end as a(-1)
#include <arrayfire.h>
using namespace af;
int main() {
info();
array a = af::randu(5, 5, f32);
int hc[] = {-1};
array d(1, hc);
af_print(a);
af_print(a(-1));
af_print(a(d));
}
In the following code, indexing array
awitha(-1)and with another array that contains a-1do not produce the same result. When indexing with a-1, the last element of the array is returned as expected. However, if the same array is indexed with another array containing a-1the first element of the array is indexed.Expected behavior
a(-1)should be equivalent toa(d)Current behavior
a(d)indexes from the beginning of the array rather than the end asa(-1)