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

## Synopsis

• Usage:
permutationMatrix s, permutationMatrix(n , c)
• Inputs:
• s, , an array or a list of arrays giving a one-line notation or cyclic notation of a permutation
• n, an integer, giving the number of integers getting permuted
• c, a list, of arrays giving a cyclic notation of a permutation
• Outputs:
• , the matrix representation of the permutation

## 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 toString 213 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. Without n the function assumes n is the largest integer that appears in your array or list of arrays.

 i2 : M = permutationMatrix(3,[1,2]) o2 = | 0 1 0 | | 1 0 0 | | 0 0 1 | 3 3 o2 : Matrix ZZ <--- ZZ i3 : M = permutationMatrix [1,2] 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 i5 : M = permutationMatrix {[1,2],[3,4]} o5 = | 0 1 0 0 | | 1 0 0 0 | | 0 0 0 1 | | 0 0 1 0 | 4 4 o5 : Matrix ZZ <--- ZZ

## Ways to use permutationMatrix :

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

## For the programmer

The object permutationMatrix is .