The matrix of a permutation p of size n is the matrix obtained by permuting the rows of the identity matrix of size n with the permutation p. Multiplying this matrix by a column vector of size n is the same as permuting the elements of the vector with the permutation p.
The permu2mat command finds the matrix of a given permutation.
Example.
Input:
Output:
⎡ ⎢ ⎢ ⎣ |
| ⎤ ⎥ ⎥ ⎦ |