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]
)
Deprecated alias of base_ring()
EXAMPLES:
sage: G = SU(3,GF(5))
sage: G.base_field()
doctest:...: DeprecationWarning: Use base_ring() instead.
See http://trac.sagemath.org/14014 for details.
Finite Field in a of size 5^2
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()
doctest:...: DeprecationWarning: Use base_ring() instead.
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
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]
(
[0 1] [0 1] [0 1] [0 2] [0 2]
[2 0], [2 1], [2 2], [1 0], [1 1]
)
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
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