Hi All,
I have got somthing that puzzles me about the definition and use of operator [].
Suppose I have a 1D array A={a,b,c,d}
And I wish to genrate a 2D array of the form B={b,a,d,c}
Then I would gusess that I should create a 2D indices array, where each index consists of a single value:
I={{2,1},{4,3}}
Such that
B=A[I];
But the documentation says:
dense< T, 2 > operator[] (const dense< array< usize, 2 >, 2 > &indices) const Returns a dense container R of the same size as indices, such that R[i] == (*this)[indices[i]].Meaning the that regradless of the dimention of the original array (in our case D=1) one needs to use a 2D indices array which consists of 2 elements (array< usize, 2 >) instead of a single one.
It would be great if some one could clarify this...
Thanks
Snir



