Reverse transpose slice


#1

Good afternoon:

I have a 3D array like this one:

CREATE ARRAY m2x2x2<val:double>[i=0:1,2,0,j=0:1,2,0,k=0:1,2,0];
store(build(m2x2x2,i*4+j*2+k),m2x2x2);

slice(m2x2x2, k, 0);
0	2
4	6

slice(m2x2x2, k, 1);
1	3
5	7

And I need a new array by reversing and tranposing each 2D slice of the original array. I would like to obtain this:

slice(new_array, k, 0);
6	2
4	0

slice(new_array, k, 1);
7	3
5	1

Right now I use “unpack”, then I use “apply” to change the indexes and finally I use “redimension” to go back to a 3D array. I think there is a better and elegant way to do this, something like:

store(reverse(transpose(slice(m2x2x2, k, XXXXX))), new_array);

Do you have any ideas?

Thanks!