I was wondering if there is a function which performs a permutation of the elements of a vector, in order to avoid the classic method consisting of defining a permutation matrix (which is filled with 1 or 0) and then calculating the product of this permutation matrix by the fixed vector.
For example, this function could probably have two vectors as input : X and P
- X is the vector whose elements are to reorder, for eg : X = (2.3 / 5.4 / 9.1 / 3.1)
- P is a vector filled with new positions, for eg : P = (2 / 1 / 4 / 3)
The supposed function will return an output vector Y (or X if it is overwritten by the reordered vector).
In the example above, Y = (5.4 / 2.3 / 3.1 / 9.1).
I have searched in the mkl manual and in the help, but I didn't succeed to find such function.
Thank you for your help !