Loading, saving, ... works:
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:
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.
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]
)
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:
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]
)
alias of MatrixGroupElement_gap
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
Return a string that tries to describe the structure of G.
This methods wraps GAP’s StructureDescription method.
Requires the optional database_gap package.
For full details, including the form of the returned string and the algorithm to build it, see GAP’s documentation.
INPUT:
OUTPUT:
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() # optional - database_gap
'C6'
sage: G.structure_description(latex=True) # optional - database_gap
'C_{6}'
sage: G2 = G.direct_product(G, maps=False)
sage: LatexExpr(G2.structure_description(latex=True)) # optional - database_gap
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() # optional - database_gap
'S3'
We use the Sage notation for the degree of dihedral groups:
sage: D4 = DihedralGroup(4)
sage: D4.structure_description() # optional - database_gap
'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() # optional - database_gap
'C7'
And matrix groups (trac ticket #17573):
sage: groups.matrix.GL(4,2).structure_description() # optional - database_gap
'A8'
Bases: sage.groups.matrix_gps.matrix_group.MatrixGroup_base
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:
TESTS:
sage: G = GL(2, QQ)
sage: from sage.groups.matrix_gps.matrix_group import MatrixGroup_generic
sage: isinstance(G, MatrixGroup_generic)
True
alias of MatrixGroupElement_generic
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
Return the group homomorphism defined by x
INPUT:
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]
)
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
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