Previous Up Next

6.9.6  Transforming a permutation into a matrix: permu2mat

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:

permu2mat([2,0,1])

Output:




       001
       100
       010




Previous Up Next