22.10 Matrix Groups

Module: sage.groups.matrix_gps.matrix_group

Matrix Groups

Author Log:

This class is designed for computing with matrix groups defined by a relatively (small) finite set of generating matrices.

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.conjugacy_class_representatives()
[
[1 0]
[0 1],
[0 1]
[2 1],
[0 1]
[2 2],
[0 2]
[1 1],
[0 2]
[1 2],
[0 1]
[2 0],
[2 0]
[0 2]
]

Loading and saving work:

sage: G = GL(2,5); G
General Linear Group of degree 2 over Finite Field of size 5
sage: loads(dumps(G)) == G
True
sage: g = G.1; g
[4 1]
[4 0]
sage: loads(dumps(g)) == g
True

Module-level Functions

MatrixGroup( gens)

Return the matrix group with given generators.

Input:

gens
- list of matrices in a matrix space or matrix group

sage: F = GF(5)
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
sage: G = MatrixGroup(gens); G
Matrix group over Finite Field of size 5 with 2 generators: 
 [[[1, 2], [4, 1]], [[1, 1], [0, 1]]]

In the second example, the generators are a matrix over $ \mathbf{Z}$ , a matrix over a finite field, and the integer $ 2$ . SAGE determines that they both canonically map to matrices over the finite field, so creates that matrix group there.

sage: gens = [matrix(2,[1,2, -1, 1]), matrix(GF(7), 2, [1,1, 0,1]), 2]
sage: G = MatrixGroup(gens); G
Matrix group over Finite Field of size 7 with 3 generators: 
 [[[1, 2], [6, 1]], [[1, 1], [0, 1]], [[2, 0], [0, 2]]]

Each generator must be invertible:

sage: G = MatrixGroup([matrix(ZZ,2,[1,2,3,4])])
Traceback (most recent call last):
...
ValueError: each generator must be an invertible matrix but one is not:
[1 2]
[3 4]

Some groups aren't supported:

sage: SL(2, CC).gens()
Traceback (most recent call last):
...
NotImplementedError: Matrix group over Complex Field with 53 bits of
precision not implemented.
sage: G = SL(0, QQ)
Traceback (most recent call last):
...
ValueError: The degree must be at least 1

is_MatrixGroup( x)

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

Class: MatrixGroup_gap

class MatrixGroup_gap
MatrixGroup_gap( self, n, R, [var=a])

Input:

n
- the degree
R
- the base ring
var
- variable used to define field of definition of actual matrices in this group.

Functions: as_matrix_group,$ \,$ base_field,$ \,$ base_ring,$ \,$ degree,$ \,$ field_of_definition,$ \,$ gen,$ \,$ gens,$ \,$ hom,$ \,$ is_finite,$ \,$ list,$ \,$ matrix_space,$ \,$ ngens,$ \,$ order

as_matrix_group( self)

Return this group, but as a general matrix group, i.e., throw away the extra structure of general unitary group.

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], [0, 2*a + 3, 0, 0], [0, 0, 4*a + 1, 0], [0, 0, 0, 3*a]],
[[1, 0, 4*a + 3, 0], [1, 0, 0, 0], [0, 2*a + 4, 0, 1], [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, 3, 0], [0, 0, 1]], [[0, 1, 0], [1, 4, 4], [0, 2, 1]]]

base_field( self)

Return the base ring of this matrix group.

sage: GL(2,GF(3)).base_ring()
Finite Field of size 3
sage: G = SU(3,GF(5))
sage: G.base_ring()
Finite Field of size 5
sage: G.field_of_definition()
Finite Field in a of size 5^2

base_ring( self)

Return the base ring of this matrix group.

sage: GL(2,GF(3)).base_ring()
Finite Field of size 3
sage: G = SU(3,GF(5))
sage: G.base_ring()
Finite Field of size 5
sage: G.field_of_definition()
Finite Field in a of size 5^2

degree( self)

Return the degree of this matrix group.

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

field_of_definition( self, [var=a])

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

       sage: G = SU(3,GF(5))
       sage: G.base_ring()
Finite Field of size 5
sage: G.field_of_definition()
       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

gen( self, n)

Return the n-th generator.

sage: G = GU(4,GF(5), var='beta')
sage: G.gen(0)     
[  beta      0      0      0]
[     0      1      0      0]
[     0      0      1      0]
[     0      0      0 3*beta]

gens( self)

Return generators for this matrix group.

sage: G = GO(3,GF(5))
sage: G.gens()
[
[2 0 0]
[0 3 0]
[0 0 1],
[0 1 0]
[1 4 4]
[0 2 1]
]

is_finite( self)

Return True if this matrix group is finite.

sage: G = GL(2,GF(3))
sage: G.is_finite()
True
sage: SL(2,ZZ).is_finite()
False

list( self)

Return list of all elements of this group.

Always returns a new list, so it is safe to change the returned list.

       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.order()
24
sage: v = G.list()
       sage: len(v)
       24
       sage: v[:2]
       [[0 1]
       [2 0], [0 1]
       [2 1]]            
       sage: G.list()[0] in G
True

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

matrix_space( self)

Return the matrix space corresponding to this matrix group.

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

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

ngens( self)

Return the number of generators of this linear group.

sage: G = GO(3,GF(5))
sage: G.ngens()
2

order( self)

       sage: G = Sp(4,GF(3))
sage: G.order()
       51840
       sage: G = SL(4,GF(3))
       sage: G.order()
       12130560
       sage: F = GF(5); MS = MatrixSpace(F,2,2)
       sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
       sage: G = MatrixGroup(gens)
       sage: G.order()
       480
       sage: G = MatrixGroup([matrix(ZZ,2,[1,1,0,1])])
       sage: G.order()
       +Infinity

Special Functions: __call__,$ \,$ __cmp__,$ \,$ __init__,$ \,$ _gap_,$ \,$ _Hom_

__call__( self, x)

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(1)
[1 0]
[0 1]

Class: MatrixGroup_gap_finite_field

class MatrixGroup_gap_finite_field

Functions: center,$ \,$ conjugacy_class_representatives,$ \,$ order,$ \,$ random,$ \,$ random_element

center( self)

Return the center of this linear group as a matrix group.

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

conjugacy_class_representatives( self)

Return a set of representatives for each of the conjugacy classes of the group.

sage: G = SU(3,GF(2))
sage: len(G.conjugacy_class_representatives())
16
sage: len(GL(2,GF(3)).conjugacy_class_representatives())
8
sage: len(GU(2,GF(5)).conjugacy_class_representatives())
36

order( self)

       sage: G = Sp(4,GF(3))
sage: G.order()
       51840
       sage: G = SL(4,GF(3))
       sage: G.order()
       12130560
       sage: F = GF(5); MS = MatrixSpace(F,2,2)
       sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
       sage: G = MatrixGroup(gens)
       sage: G.order()
       480
       sage: G = MatrixGroup([matrix(ZZ,2,[1,1,0,1])])
       sage: G.order()
       +Infinity

random( self)

Deprecated. Use self.random_element() instead.

random_element( self)

Return a random element of this group.

sage: G = Sp(4,GF(3))
sage: G.random_element()
[2 1 1 1]
[1 0 2 1]
[0 1 1 0]
[1 0 0 1]

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G.random_element()
[1 3]
[0 3]
sage: G.random_element()
[2 2]
[1 0]
sage: G.random_element()
[4 0]
[1 4]

Special Functions: __contains__

__contains__( self, x)

Return True if $ x$ is an element of this abelian group.

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: G = MatrixGroup([MS(1), MS([1,2,3,4])])
sage: G
Matrix group over Finite Field of size 5 with 2 generators: 
 [[[1, 0], [0, 1]], [[1, 2], [3, 4]]]
sage: G.order()
8
sage: G(1)
[1 0]
[0 1]
sage: G.1 in G
True
sage: 1 in G
True
sage: [1,2,3,4] in G
True
sage: matrix(GF(5),2,[1,2,3,5]) in G
False
sage: G(matrix(GF(5),2,[1,2,3,5]))
Traceback (most recent call last):
...
TypeError: no way to coerce element to self.

Class: MatrixGroup_generic

class MatrixGroup_generic

Class: MatrixGroup_gens

class MatrixGroup_gens

A ValueError is raised if one of the generators is not invertible.

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: G = MatrixGroup([MS.0])
Traceback (most recent call last):
...
ValueError: each generator must be an invertible matrix but one is not:
[1 0]
[0 0]
MatrixGroup_gens( self, gensG)

Functions: gens,$ \,$ invariant_generators

gens( self)

       sage: F = GF(3); MS = MatrixSpace(F,2,2)
       sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
       sage: gens[0] in G
       True
       sage: gens = G.gens()
       sage: gens[0] in G
       True
       sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: G = MatrixGroup([MS(1), MS([1,2,3,4])])
sage: G
Matrix group over Finite Field of size 5 with 2 generators:
 [[[1, 0], [0, 1]], [[1, 2], [3, 4]]]
sage: G.gens()
[[1 0]
[0 1], [1 2]
[3 4]]

invariant_generators( self)

Wraps Singular's invariant_algebra_reynolds and invariant_ring in finvar.lib, with help from Simon King and Martin Albrecht. Computes generators for the polynomial ring $ F[x_1,\ldots,x_n]^G$ , where G in GL(n,F) is a finite matrix group.

In the "good characteristic" case the polynomials returned form a minimal generating set for the algebra of G-invariant polynomials. In the "bad" case, the polynomials returned are primary and secondary invariants, forming a not necessarily minimal generating set for the algebra of G-invariant polynomials.

sage: F = GF(7); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[0,1],[-1,0]]),MS([[1,1],[2,3]])]
sage: G = MatrixGroup(gens)
sage: G.invariant_generators()
[x1^7*x2 - x1*x2^7, x1^12 - 2*x1^9*x2^3 - x1^6*x2^6 + 2*x1^3*x2^9 + x2^12,
x1^18 + 2*x1^15*x2^3 + 3*x1^12*x2^6 + 3*x1^6*x2^12 - 2*x1^3*x2^15 + x2^18]
sage: q = 4; a = 2
sage: MS = MatrixSpace(QQ, 2, 2)
sage: gen1 = [[1/a,(q-1)/a],[1/a, -1/a]]; gen2 = [[1,0],[0,-1]]; gen3 = [[-1,0],[0,1]]
sage: G = MatrixGroup([MS(gen1),MS(gen2),MS(gen3)])
sage: G.order()
12
sage: G.invariant_generators()
[x1^2 + 3*x2^2, x1^6 + 15*x1^4*x2^2 + 15*x1^2*x2^4 + 33*x2^6]
sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[-1,1]])]
sage: G = MatrixGroup(gens)
sage: G.invariant_generators()  ## takes a long time (several mins)
[x1^20 + x1^16*x2^4 + x1^12*x2^8 + x1^8*x2^12 + x1^4*x2^16 + x2^20,
x1^20*x2^4 + x1^16*x2^8 + x1^12*x2^12 + x1^8*x2^16 + x1^4*x2^20]
sage: F=CyclotomicField(8)
sage: z=F.gen()
sage: a=z+1/z
sage: b=z^2
sage: MS=MatrixSpace(F,2,2)
sage: g1=MS([[1/a,1/a],[1/a,-1/a]])
sage: g2=MS([[1,0],[0,b]])
sage: g3=MS([[b,0],[0,1]])
sage: G=MatrixGroup([g1,g2,g3])
sage: G.invariant_generators()
[x1^8 + 14*x1^4*x2^4 + x2^8,
 x1^24 + 10626/1025*x1^20*x2^4 + 735471/1025*x1^16*x2^8 +
2704156/1025*x1^12*x2^12 + 735471/1025*x1^8*x2^16 + 10626/1025*x1^4*x2^20 +
x2^24]

Author: David Joyner, Simon King and Martin Albrecht.

REFERENCES: 1. Singular reference manual 2. B. Sturmfels, "Algorithms in invariant theory", Springer-Verlag, 1993. 3. S. King, "Minimal Generating Sets of non-modular invariant rings of finite groups", arXiv:math.AC/0703035

Special Functions: __init__,$ \,$ _gap_init_,$ \,$ _latex_,$ \,$ _repr_

_gap_init_( self)

Returns a string representation of the corresponding GAP object.

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G._gap_init_() # The variable $sage11 belongs to gap(F) and is somehow random
'Group([[Z(5)^0,Z(5)^1],[Z(5)^2,Z(5)^0]]*One($sage11),[[Z(5)^0,Z(5)^0],[0*Z
(5),Z(5)^0]]*One($sage11))'
sage: gap(G._gap_init_())
Group([ [ [ Z(5)^0, Z(5) ], [ Z(5)^2, Z(5)^0 ] ],
  [ [ Z(5)^0, Z(5)^0 ], [ 0*Z(5), Z(5)^0 ] ] ])

_latex_( self)

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: latex(G)
\left\langle \left(\begin{array}{rr}
1 \& 2 \\
4 \& 1
\end{array}\right), \left(\begin{array}{rr}
1 \& 1 \\
0 \& 1
\end{array}\right) \right\rangle

_repr_( self)

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G
Matrix group over Finite Field of size 5 with 2 generators:
 [[[1, 2], [4, 1]], [[1, 1], [0, 1]]]

Class: MatrixGroup_gens_finite_field

class MatrixGroup_gens_finite_field

See About this document... for information on suggesting changes.