Macaulay2 » Documentation
Packages » MatrixSchubert :: permToMatrix
next | previous | forward | backward | up | index | toc

permToMatrix -- converts a permutation in 1-line notation into a permutation matrix

Synopsis

Description

Given a permutation in 1-line notation, produces the permutation matrix with 1's in location $(i,w_i)$.

i1 : w = {7,2,5,8,1,3,6,4}

o1 = {7, 2, 5, 8, 1, 3, 6, 4}

o1 : List
i2 : permToMatrix w

o2 = | 0 0 0 0 0 0 1 0 |
     | 0 1 0 0 0 0 0 0 |
     | 0 0 0 0 1 0 0 0 |
     | 0 0 0 0 0 0 0 1 |
     | 1 0 0 0 0 0 0 0 |
     | 0 0 1 0 0 0 0 0 |
     | 0 0 0 0 0 1 0 0 |
     | 0 0 0 1 0 0 0 0 |

              8       8
o2 : Matrix ZZ  <-- ZZ
i3 : v = {1,6,9,2,4,7,3,5,8}

o3 = {1, 6, 9, 2, 4, 7, 3, 5, 8}

o3 : List
i4 : permToMatrix v

o4 = | 1 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 1 0 0 0 |
     | 0 0 0 0 0 0 0 0 1 |
     | 0 1 0 0 0 0 0 0 0 |
     | 0 0 0 1 0 0 0 0 0 |
     | 0 0 0 0 0 0 1 0 0 |
     | 0 0 1 0 0 0 0 0 0 |
     | 0 0 0 0 1 0 0 0 0 |
     | 0 0 0 0 0 0 0 1 0 |

              9       9
o4 : Matrix ZZ  <-- ZZ

Ways to use permToMatrix :

For the programmer

The object permToMatrix is a method function.