I am not really sure If I should ask this question here but I know there are some really smart guys out there, so what the hell :)!!!.
Here you go : suppose you have a three dimensional cube of data that you would fill like this
for (int i = 0 ; i < dim1; i++)
for (int j = 0 ; j < dim2; j++)
for (int k = 0 ; k < dim3; k++)
data[i*dim2*dim3 + j*dim3 + k] = rand();
you now want to reshuffle the cube so that 2 of the three dimensions are switched or even three. HOW DO YOU DO THAT
I found a paper called “An Optimal Index Reshuffle Algorithm for Multidimensional Arrays and its Applications for Parallel Architectures”. that solves the problem for any multidimensional array but it is hardly parallelizable.
Does any one of you somewhere out there have any idea how this could be done in parallel and in-place? I insist on the In-Place part because otherwise, it would be enough to traverse the cube in the new order and create the mapping between the indices.
Thank you for being.