Coloured Permutations in GAP I

Here is a function to produce a coloured permutation matrix in GAP:

 
ColouredMatrix := function( sigma, colours )
	local p,d;
	p := PermutationMat(sigma, Length(colours), Rationals);
	d := DiagonalMat(colours);
	return p * d;
end;
 
.

For example:

 
gap> A := ColouredMatrix((1,2,3,4),[E(3),1,E(3)^2,E(3)]);
 
[ [ 0, 1, 0, 0 ], [ 0, 0, E(3)^2, 0 ], [ 0, 0, 0, E(3) ], [ E(3), 0, 0, 0 ] ]
 
.

Remember that in GAP, the symbol E(3) denotes the primitive cube root of unity. Now we can diagonalize this matrix and find its eigenvectors:

 
gap> Eigenvalues(CF(12), A);
 
[ E(3), -E(3), E(12)^7, -E(12)^7 ]
 
gap> Eigenvectors(CF(12),A);
 
[ [ 1, E(3)^2, 1, 1 ], [ 1, -E(3)^2, 1, -1 ], [ 1, -E(12)^11, -1, E(4) ], 
  [ 1, E(12)^11, -1, -E(4) ] ]
 
.

Remember that in GAP CF(12) is the cyclotomic field extension containing all the twelth roots of unity.

To generate all the coloured permutation matrices of given dimensions we could do something like:

 
AllCombinations := function( k, n );
	if n = 1 then
		return List([1..k], i -> [i]);
	else return Concatenation(List([1..k], 
                                  i -> List( (AllCombinations( k, (n-1)) ), 
                                  ys -> Concatenation([i],ys)  ) 
                    ));
	fi;
end;
 
fish := function( xs, ys )
	local k, new;
	new := [];
	for k in [1..Length(xs)] do
		new[k] := ys[xs[k]];
	od;
	return new;
end;
 
AllColouredMatrices := function( k, n )
	local perms, colours, colourvectors, tori;
	perms := Elements(SymmetricGroup(n));
	colours := List([1..k],i -> E(k)^i);
	colourvectors := List(AllCombinations(k,n), xs -> fish(xs,colours));
	return Concatenation(List(perms, 
                                           sigma -> List(colourvectors, 
                                                  c -> ColouredMatrix(sigma,c) 
                                     )));
end;
 
.

Check it out:

 
gap> AllColouredMatrices(2,2);        
 
[ [ [ -1, 0 ], [ 0, -1 ] ], [ [ -1, 0 ], [ 0, 1 ] ], [ [ 1, 0 ], [ 0, -1 ] ], 
  [ [ 1, 0 ], [ 0, 1 ] ], [ [ 0, -1 ], [ -1, 0 ] ], [ [ 0, 1 ], [ -1, 0 ] ], 
  [ [ 0, -1 ], [ 1, 0 ] ], [ [ 0, 1 ], [ 1, 0 ] ] ]
 
gap> AllColouredMatrices(3,2);
 
[ [ [ E(3), 0 ], [ 0, E(3) ] ], [ [ E(3), 0 ], [ 0, E(3)^2 ] ], 
  [ [ E(3), 0 ], [ 0, 1 ] ], [ [ E(3)^2, 0 ], [ 0, E(3) ] ], 
  [ [ E(3)^2, 0 ], [ 0, E(3)^2 ] ], [ [ E(3)^2, 0 ], [ 0, 1 ] ], 
  [ [ 1, 0 ], [ 0, E(3) ] ], [ [ 1, 0 ], [ 0, E(3)^2 ] ], 
  [ [ 1, 0 ], [ 0, 1 ] ], [ [ 0, E(3) ], [ E(3), 0 ] ], 
  [ [ 0, E(3)^2 ], [ E(3), 0 ] ], [ [ 0, 1 ], [ E(3), 0 ] ], 
  [ [ 0, E(3) ], [ E(3)^2, 0 ] ], [ [ 0, E(3)^2 ], [ E(3)^2, 0 ] ], 
  [ [ 0, 1 ], [ E(3)^2, 0 ] ], [ [ 0, E(3) ], [ 1, 0 ] ], 
  [ [ 0, E(3)^2 ], [ 1, 0 ] ], [ [ 0, 1 ], [ 1, 0 ] ] ]
 
.

Of course there’s always more than one way of doing exactly the same thing, so:

 
ColouredPerms := function( k,n )
	local ck, sn;
	ck := CyclicGroup(IsPermGroup,k);
	sn := SymmetricGroup(n);
	return WreathProduct(ck,sn);
end;
 
.

For example:

 
gap> hyp2 := ColouredPerms(2,2);
 
Group([ (1,2), (3,4), (1,3)(2,4) ])
 
gap> Elements(hyp2);
 
[ (), (3,4), (1,2), (1,2)(3,4), (1,3)(2,4), (1,3,2,4), (1,4,2,3), (1,4)(2,3) ]
 
.

Here GAP is thinking of a signed permutation on symbols as regular permutations on symbols whose action by conjugation stabilizes the permutation:

A slightly larger example:

 
gap> hyp3 := ColouredPerms(2,3);
 
Group([ (1,2), (3,4), (5,6), (1,3,5)(2,4,6), (1,3)(2,4) ])
 
gap> Elements(hyp3);
 
[ (), (5,6), (3,4), (3,4)(5,6), (3,5)(4,6), (3,5,4,6), (3,6,4,5), (3,6)(4,5), 
  (1,2), (1,2)(5,6), (1,2)(3,4), (1,2)(3,4)(5,6), (1,2)(3,5)(4,6), 
  (1,2)(3,5,4,6), (1,2)(3,6,4,5), (1,2)(3,6)(4,5), (1,3)(2,4), 
  (1,3)(2,4)(5,6), (1,3,2,4), (1,3,2,4)(5,6), (1,3,5)(2,4,6), (1,3,5,2,4,6), 
  (1,3,6,2,4,5), (1,3,6)(2,4,5), (1,4,2,3), (1,4,2,3)(5,6), (1,4)(2,3), 
  (1,4)(2,3)(5,6), (1,4,6,2,3,5), (1,4,6)(2,3,5), (1,4,5)(2,3,6), 
  (1,4,5,2,3,6), (1,5,3)(2,6,4), (1,5,4,2,6,3), (1,5,3,2,6,4), 
  (1,5,4)(2,6,3), (1,5)(2,6), (1,5,2,6), (1,5)(2,6)(3,4), (1,5,2,6)(3,4), 
  (1,6,4,2,5,3), (1,6,3)(2,5,4), (1,6,4)(2,5,3), (1,6,3,2,5,4), (1,6,2,5), 
  (1,6)(2,5), (1,6,2,5)(3,4), (1,6)(2,5)(3,4) ]
 
.

To confirm my claim about commuting with the permutation

 
gap> Elements(Centralizer(SymmetricGroup(6), (1,2)(3,4)(5,6)));
 
[ (), (5,6), (3,4), (3,4)(5,6), (3,5)(4,6), (3,5,4,6), (3,6,4,5), (3,6)(4,5), 
  (1,2), (1,2)(5,6), (1,2)(3,4), (1,2)(3,4)(5,6), (1,2)(3,5)(4,6), 
  (1,2)(3,5,4,6), (1,2)(3,6,4,5), (1,2)(3,6)(4,5), (1,3)(2,4), 
  (1,3)(2,4)(5,6), (1,3,2,4), (1,3,2,4)(5,6), (1,3,5)(2,4,6), (1,3,5,2,4,6), 
  (1,3,6,2,4,5), (1,3,6)(2,4,5), (1,4,2,3), (1,4,2,3)(5,6), (1,4)(2,3), 
  (1,4)(2,3)(5,6), (1,4,6,2,3,5), (1,4,6)(2,3,5), (1,4,5)(2,3,6), 
  (1,4,5,2,3,6), (1,5,3)(2,6,4), (1,5,4,2,6,3), (1,5,3,2,6,4), 
  (1,5,4)(2,6,3), (1,5)(2,6), (1,5,2,6), (1,5)(2,6)(3,4), (1,5,2,6)(3,4), 
  (1,6,4,2,5,3), (1,6,3)(2,5,4), (1,6,4)(2,5,3), (1,6,3,2,5,4), (1,6,2,5), 
  (1,6)(2,5), (1,6,2,5)(3,4), (1,6)(2,5)(3,4) ]
 
.

What we need now is a way to translate between these two different representations of the same mathematical object.

plain text version

Leave a Reply