Create matrix from permutations

86 Views Asked by At

I have a set of four permutations $\{(\cdots),(3,4),(2,4),(2,3)\}$. I want to create a $4 \times 4 $ matrix with rows as above permutations. For example in this case matrix will be \begin{bmatrix} 1 & 2 & 3 & 4 \\ 1 & 2 & 4 & 3 \\ 1 & 4 & 3 & 2 \\ 1 & 3 & 2 & 4 \end{bmatrix} How can I write a gap code to do so for a list of permutations?

1

There are 1 best solutions below

0
On BEST ANSWER

The operation ListPerm(perm,degree) converts a permutation to a list of images. Since matrices are lists of lists, you can thus achieve the desired result by putting it into a List command:

gap> l:=[(),(3,4),(2,4),(2,3)];
[ (), (3,4), (2,4), (2,3) ]
gap> deg:=LargestMovedPoint(l);
4
gap> mat:=List(l,x->ListPerm(x,deg));
[ [ 1 .. 4 ], [ 1, 2, 4, 3 ], [ 1, 4, 3, 2 ], [ 1, 3, 2, 4 ] ]
gap> Display(mat);
[ [  1,  2,  3,  4 ],
  [  1,  2,  4,  3 ],
  [  1,  4,  3,  2 ],
  [  1,  3,  2,  4 ] ]