# 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.
• Sebastian Oehms (2018-07): Add subgroup() and ambient() see trac ticket #25894
class sage.groups.matrix_gps.matrix_group.MatrixGroup_base

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.

ambient()

Return the ambient group of a subgroup.

OUTPUT:

A group containing self. If self has not been defined as a subgroup, we just return self.

EXAMPLES:

sage: G = GL(2,QQ)
sage: m = matrix(QQ, 2,2, [[3, 0],[~5,1]])
sage: S = G.subgroup([m])
sage: S.ambient() is G
True

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]
)

subgroup(generators, check=True)

Return the subgroup generated by the given generators.

INPUT:

• generators – a list/tuple/iterable of group elements of self
• check – boolean (optional, default: True). Whether to check that each matrix is invertible.

OUTPUT: The subgroup generated by generators as an instance of FinitelyGeneratedMatrixGroup_gap

EAMPLES:

sage: UCF = UniversalCyclotomicField()
sage: G  = GL(3, UCF)
sage: e3 = UCF.gen(3); e5 =UCF.gen(5)
sage: m = matrix(UCF, 3,3, [[e3, 1, 0], [0, e5, 7],[4, 3, 2]])
sage: S = G.subgroup([m]); S
Subgroup with 1 generators (
[E(3)    1    0]
[   0 E(5)    7]
[   4    3    2]
) of General Linear Group of degree 3 over Universal Cyclotomic Field

sage: CF3 = CyclotomicField(3)
sage: G  = GL(3, CF3)
sage: e3 = CF3.gen()
sage: m = matrix(CF3, 3,3, [[e3, 1, 0], [0, ~e3, 7],[4, 3, 2]])
sage: S = G.subgroup([m]); S
Subgroup with 1 generators (
[     zeta3          1          0]
[         0 -zeta3 - 1          7]
[         4          3          2]
) of General Linear Group of degree 3 over Cyclotomic Field of order 3 and degree 2

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

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.
Element
structure_description(G, latex=False)

Return a string that tries to describe the structure of G.

This methods wraps GAP’s StructureDescription method.

For full details, including the form of the returned string and the algorithm to build it, see GAP’s documentation.

INPUT:

• latex – a boolean (default: False). If True return a LaTeX formatted string.

OUTPUT:

• string

Warning

From GAP’s documentation: The string returned by StructureDescription is not an isomorphism invariant: non-isomorphic groups can have the same string value, and two isomorphic groups in different representations can produce different strings.

EXAMPLES:

sage: G = CyclicPermutationGroup(6)
sage: G.structure_description()
'C6'
sage: G.structure_description(latex=True)
'C_{6}'
sage: G2 = G.direct_product(G, maps=False)
sage: LatexExpr(G2.structure_description(latex=True))
C_{6} \times C_{6}


This method is mainly intended for small groups or groups with few normal subgroups. Even then there are some surprises:

sage: D3 = DihedralGroup(3)
sage: D3.structure_description()
'S3'


We use the Sage notation for the degree of dihedral groups:

sage: D4 = DihedralGroup(4)
sage: D4.structure_description()
'D4'


Works for finitely presented groups (trac ticket #17573):

sage: F.<x, y> = FreeGroup()
sage: G=F / [x^2*y^-1, x^3*y^2, x*y*x^-1*y^-1]
sage: G.structure_description()
'C7'


And matrix groups (trac ticket #17573):

sage: groups.matrix.GL(4,2).structure_description()
'A8'

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.
Element
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

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