Conjugacy classes of groups#

This module implements a wrapper of GAP’s `ConjugacyClass` function.

There are two main classes, `ConjugacyClass` and `ConjugacyClassGAP`. All generic methods should go into `ConjugacyClass`, whereas `ConjugacyClassGAP` should only contain wrappers for GAP functions. `ConjugacyClass` contains some fallback methods in case some group cannot be defined as a GAP object.

Todo

• Implement a non-naive fallback method for computing all the elements of the conjugacy class when the group is not defined in GAP, as the one in Butler’s paper.

• Define a sage method for gap matrices so that groups of matrices can use the quicker GAP algorithm rather than the naive one.

EXAMPLES:

Conjugacy classes for groups of permutations:

```sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: G.conjugacy_class(g)                                                          # needs sage.combinat
Conjugacy class of cycle type [4] in Symmetric group of order 4! as a permutation group
```

Conjugacy classes for groups of matrices:

```sage: F = GF(5)
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
sage: H = MatrixGroup(gens)
sage: h = H(matrix(F,2,[1,2, -1, 1]))
sage: H.conjugacy_class(h)
Conjugacy class of [1 2]
[4 1] in Matrix group over Finite Field of size 5 with 2 generators (
[1 2]  [1 1]
[4 1], [0 1]
)
```
class sage.groups.conjugacy_classes.ConjugacyClass(group, element)#

Bases: `Parent`

Generic conjugacy classes for elements in a group.

This is the default fall-back implementation to be used whenever GAP cannot handle the group.

EXAMPLES:

```sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: ConjugacyClass(G,g)
Conjugacy class of (1,2,3,4) in Symmetric group of order 4! as a
permutation group
```
an_element()#

Return a representative of `self`.

EXAMPLES:

```sage: G = SymmetricGroup(3)
sage: g = G((1,2,3))
sage: C = ConjugacyClass(G,g)
sage: C.representative()
(1,2,3)
```
is_rational()#

Check if `self` is rational (closed for powers).

EXAMPLES:

```sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: c = ConjugacyClass(G,g)
sage: c.is_rational()
False
```
is_real()#

Check if `self` is real (closed for inverses).

EXAMPLES:

```sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: c = ConjugacyClass(G,g)
sage: c.is_real()
True
```
list()#

Return a list with all the elements of `self`.

EXAMPLES:

Groups of permutations:

```sage: G = SymmetricGroup(3)
sage: g = G((1,2,3))
sage: c = ConjugacyClass(G,g)
sage: L = c.list()
sage: Set(L) == Set([G((1,3,2)), G((1,2,3))])
True
```
representative()#

Return a representative of `self`.

EXAMPLES:

```sage: G = SymmetricGroup(3)
sage: g = G((1,2,3))
sage: C = ConjugacyClass(G,g)
sage: C.representative()
(1,2,3)
```
set()#

Return the set of elements of the conjugacy class.

EXAMPLES:

Groups of permutations:

```sage: G = SymmetricGroup(3)
sage: g = G((1,2))
sage: C = ConjugacyClass(G,g)
sage: S = [(2,3), (1,2), (1,3)]
sage: C.set() == Set(G(x) for x in S)
True
```

Groups of matrices over finite fields:

```sage: F = GF(5)
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
sage: H = MatrixGroup(gens)
sage: h = H(matrix(F,2,[1,2, -1, 1]))
sage: C = ConjugacyClass(H,h)
sage: S = [[[3, 2], [2, 4]], [[0, 1], [2, 2]], [[3, 4], [1, 4]],\
[[0, 3], [4, 2]], [[1, 2], [4, 1]], [[2, 1], [2, 0]],\
[[4, 1], [4, 3]], [[4, 4], [1, 3]], [[2, 4], [3, 0]],\
[[1, 4], [2, 1]], [[3, 3], [3, 4]], [[2, 3], [4, 0]],\
[[0, 2], [1, 2]], [[1, 3], [1, 1]], [[4, 3], [3, 3]],\
[[4, 2], [2, 3]], [[0, 4], [3, 2]], [[1, 1], [3, 1]],\
[[2, 2], [1, 0]], [[3, 1], [4, 4]]]
sage: C.set() == Set(H(x) for x in S)
True
```

It is not implemented for infinite groups:

```sage: a = matrix(ZZ,2,[1,1,0,1])
sage: b = matrix(ZZ,2,[1,0,1,1])
sage: G = MatrixGroup([a,b])        # takes 1s
sage: g = G(a)
sage: C = ConjugacyClass(G, g)
sage: C.set()
Traceback (most recent call last):
...
NotImplementedError: Listing the elements of conjugacy classes is not implemented for infinite groups! Use the iter function instead.
```
class sage.groups.conjugacy_classes.ConjugacyClassGAP(group, element)#

Bases: `ConjugacyClass`

Class for a conjugacy class for groups defined over GAP.

Intended for wrapping GAP methods on conjugacy classes.

INPUT:

• `group` – the group in which the conjugacy class is taken

• `element` – the element generating the conjugacy class

EXAMPLES:

```sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: ConjugacyClassGAP(G,g)
Conjugacy class of (1,2,3,4) in Symmetric group of order 4! as a
permutation group
```
cardinality()#

Return the size of this conjugacy class.

EXAMPLES:

```sage: # needs sage.rings.number_field
sage: W = WeylGroup(['C',6])
sage: cc = W.conjugacy_class(W.an_element())
sage: cc.cardinality()
3840
sage: type(cc.cardinality())
<class 'sage.rings.integer.Integer'>
```
set()#

Return a Sage `Set` with all the elements of the conjugacy class.

By default attempts to use GAP construction of the conjugacy class. If GAP method is not implemented for the given group, and the group is finite, falls back to a naive algorithm.

Warning

The naive algorithm can be really slow and memory intensive.

EXAMPLES:

Groups of permutations:

```sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: C = ConjugacyClassGAP(G,g)
sage: S = [(1,3,2,4), (1,4,3,2), (1,3,4,2), (1,2,3,4), (1,4,2,3), (1,2,4,3)]
sage: C.set() == Set(G(x) for x in S)
True
```