Macaulay2 » Documentation
Packages » InvariantRing :: permutationMatrix
next | previous | forward | backward | up | index | toc

permutationMatrix -- convert a one-line notation or cyclic notation of a permutation to a matrix representation

Description

This function is provided by the package InvariantRing.

The following example converts the one-line notation of a transposition into a matrix representation.

i1 : M = permutationMatrix [2, 1, 3]

o1 = | 0 1 0 |
     | 1 0 0 |
     | 0 0 1 |

              3       3
o1 : Matrix ZZ  <-- ZZ

The following example converts the cyclic notation of the same transposition into a matrix representation.

i2 : M = permutationMatrix(3,[1,2])

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

              3       3
o2 : Matrix ZZ  <-- ZZ

If n is the largest integer that appears in your array, the value of n can be omitted by using the option EntryMode => "cycle".

i3 : M = permutationMatrix([1,2], EntryMode => "cycle")

o3 = | 0 1 |
     | 1 0 |

              2       2
o3 : Matrix ZZ  <-- ZZ

The following example converts the cyclic notation of a permutation of 4 into a matrix representation.

i4 : M = permutationMatrix(4,{[1,2],[3,4]})

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

              4       4
o4 : Matrix ZZ  <-- ZZ

Ways to use permutationMatrix:

  • permutationMatrix(Array)
  • permutationMatrix(List)
  • permutationMatrix(ZZ,Array)
  • permutationMatrix(ZZ,List)

For the programmer

The object permutationMatrix is a method function with options.


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/InvariantRing/FiniteGroupsDoc.m2:356:0.