Transforming a permutation into a matrix

### 11.2.6 Transforming a permutation into a matrix

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.

- permu2mat takes p, a permutation p.
- permu2mat(p) returns the matrix of the permutation p.

#### Example

permu2mat([2,0,1])

⎡ ⎢ ⎢ ⎣ |
0 | 0 | 1
1 | 0 | 0
0 | 1 | 0
| ⎤ ⎥ ⎥ ⎦