# Base classes for Matrix Groups¶

sage: G = GL(2,5); G
General Linear Group of degree 2 over Finite Field of size 5
sage: TestSuite(G).run()

sage: g = G.1; g
[4 1]
[4 0]
sage: TestSuite(g).run()


We test that trac ticket #9437 is fixed:

sage: len(list(SL(2, Zmod(4))))
48


AUTHORS:

• William Stein: initial version
• David Joyner (2006-03-15): degree, base_ring, _contains_, list, random, order methods; examples
• William Stein (2006-12): rewrite
• David Joyner (2007-12): Added invariant_generators (with Martin Albrecht and Simon King)
• David Joyner (2008-08): Added module_composition_factors (interface to GAP’s MeatAxe implementation) and as_permutation_group (returns isomorphic PermutationGroup).
• Simon King (2010-05): Improve invariant_generators by using GAP for the construction of the Reynolds operator in Singular.
class sage.groups.matrix_gps.matrix_group.MatrixGroup_base

Bases: sage.groups.group.Group

Base class for all matrix groups.

This base class just holds the base ring, but not the degree. So it can be a base for affine groups where the natural matrix is larger than the degree of the affine group. Makes no assumption about the group except that its elements have a matrix() method.

as_matrix_group()

Return a new matrix group from the generators.

This will throw away any extra structure (encoded in a derived class) that a group of special matrices has.

EXAMPLES:

sage: G = SU(4,GF(5))
sage: G.as_matrix_group()
Matrix group over Finite Field in a of size 5^2 with 2 generators (
[      a       0       0       0]  [      1       0 4*a + 3       0]
[      0 2*a + 3       0       0]  [      1       0       0       0]
[      0       0 4*a + 1       0]  [      0 2*a + 4       0       1]
[      0       0       0     3*a], [      0 3*a + 1       0       0]
)

sage: G = GO(3,GF(5))
sage: G.as_matrix_group()
Matrix group over Finite Field of size 5 with 2 generators (
[2 0 0]  [0 1 0]
[0 3 0]  [1 4 4]
[0 0 1], [0 2 1]
)

base_field()

Deprecated alias of base_ring()

EXAMPLES:

sage: G = SU(3,GF(5))
sage: G.base_field()
See http://trac.sagemath.org/14014 for details.
Finite Field in a of size 5^2

field_of_definition(**kwds)

Return a field that contains all the matrices in this matrix group.

EXAMPLES:

sage: G = SU(3,GF(5))
sage: G.base_ring()
Finite Field in a of size 5^2
sage: G.field_of_definition()
See http://trac.sagemath.org/14014 for details.
Finite Field in a of size 5^2
sage: G = GO(4,GF(7),1)
sage: G.field_of_definition()
Finite Field of size 7
sage: G.base_ring()
Finite Field of size 7

class sage.groups.matrix_gps.matrix_group.MatrixGroup_gap(degree, base_ring, libgap_group, ambient=None, category=None)

Bases: sage.groups.libgap_mixin.GroupMixinLibGAP, sage.groups.matrix_gps.matrix_group.MatrixGroup_generic, sage.groups.libgap_wrapper.ParentLibGAP

Base class for matrix groups that implements GAP interface.

INPUT:

• degree – integer. The degree (matrix size) of the matrix group.
• base_ring – ring. The base ring of the matrices.
• libgap_group – the defining libgap group.
• ambient – A derived class of ParentLibGAP or None (default). The ambient class if libgap_group has been defined as a subgroup.

TESTS:

sage: from sage.groups.matrix_gps.matrix_group import MatrixGroup_gap
sage: MatrixGroup_gap(2, ZZ, libgap.eval('GL(2, Integers)'))
Matrix group over Integer Ring with 3 generators (
[0 1]  [-1  0]  [1 1]
[1 0], [ 0  1], [0 1]
)

Element

alias of MatrixGroupElement_gap

list()

List all elements of this group.

This method overrides the matrix group enumerator in GAP which is very slow, see http://tracker.gap-system.org/issues/369.

OUTPUT:

A tuple containing all group elements in a random but fixed order.

EXAMPLES:

sage: F = GF(3)
sage: gens = [matrix(F,2, [1,0, -1,1]), matrix(F, 2, [1,1,0,1])]
sage: G = MatrixGroup(gens)
sage: G.cardinality()
24
sage: v = G.list()
sage: len(v)
24
sage: v[:5]
(
[1 0]  [2 0]  [0 1]  [0 2]  [1 2]
[0 1], [0 2], [2 0], [1 0], [2 2]
)
sage: all(g in G for g in G.list())
True


An example over a ring (see trac 5241):

sage: M1 = matrix(ZZ,2,[[-1,0],[0,1]])
sage: M2 = matrix(ZZ,2,[[1,0],[0,-1]])
sage: M3 = matrix(ZZ,2,[[-1,0],[0,-1]])
sage: MG = MatrixGroup([M1, M2, M3])
sage: MG.list()
(
[1 0]  [ 1  0]  [-1  0]  [-1  0]
[0 1], [ 0 -1], [ 0  1], [ 0 -1]
)
sage: MG.list()[1]
[ 1  0]
[ 0 -1]
sage: MG.list()[1].parent()
Matrix group over Integer Ring with 3 generators (
[-1  0]  [ 1  0]  [-1  0]
[ 0  1], [ 0 -1], [ 0 -1]
)


An example over a field (see trac 10515):

sage: gens = [matrix(QQ,2,[1,0,0,1])]
sage: MatrixGroup(gens).list()
(
[1 0]
[0 1]
)


Another example over a ring (see trac 9437):

sage: len(SL(2, Zmod(4)).list())
48


An error is raised if the group is not finite:

sage: GL(2,ZZ).list()
Traceback (most recent call last):
...
NotImplementedError: group must be finite

class sage.groups.matrix_gps.matrix_group.MatrixGroup_generic(degree, base_ring, category=None)

Base class for matrix groups over generic base rings

You should not use this class directly. Instead, use one of the more specialized derived classes.

INPUT:

• degree – integer. The degree (matrix size) of the matrix group.
• base_ring – ring. The base ring of the matrices.

TESTS:

sage: G = GL(2, QQ)
sage: from sage.groups.matrix_gps.matrix_group import MatrixGroup_generic
sage: isinstance(G, MatrixGroup_generic)
True

Element

alias of MatrixGroupElement_generic

degree()

Return the degree of this matrix group.

OUTPUT:

Integer. The size (number of rows equals number of columns) of the matrices.

EXAMPLES:

sage: SU(5,5).degree()
5

hom(x)

Return the group homomorphism defined by x

INPUT:

• x – a list/tuple/iterable of matrix group elements.

OUTPUT:

The group homomorphism defined by x.

EXAMPLES:

sage: G = MatrixGroup([matrix(GF(5), [[1,3],[0,1]])])
sage: H = MatrixGroup([matrix(GF(5), [[1,2],[0,1]])])
sage: G.hom([H.gen(0)])
Homomorphism : Matrix group over Finite Field of size 5 with 1 generators (
[1 3]
[0 1]
) --> Matrix group over Finite Field of size 5 with 1 generators (
[1 2]
[0 1]
)

matrix_space()

Return the matrix space corresponding to this matrix group.

This is a matrix space over the field of definition of this matrix group.

EXAMPLES:

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: G = MatrixGroup([MS(1), MS([1,2,3,4])])
sage: G.matrix_space()
Full MatrixSpace of 2 by 2 dense matrices over Finite Field of size 5
sage: G.matrix_space() is MS
True

sage.groups.matrix_gps.matrix_group.is_MatrixGroup(x)

Test whether x is a matrix group.

EXAMPLES:

sage: from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
sage: is_MatrixGroup(MatrixSpace(QQ,3))
False
sage: is_MatrixGroup(Mat(QQ,3))
False
sage: is_MatrixGroup(GL(2,ZZ))
True
sage: is_MatrixGroup(MatrixGroup([matrix(2,[1,1,0,1])]))
True


#### Previous topic

Rubik’s cube group functions

#### Next topic

Matrix Group Elements