Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/groups/matrix_gps/homset.py
8815 views
1
"""
2
Matrix Group Homsets
3
4
AUTHORS:
5
6
- William Stein (2006-05-07): initial version
7
8
- Volker Braun (2013-1) port to new Parent, libGAP
9
"""
10
11
##############################################################################
12
# Copyright (C) 2006 David Joyner and William Stein <[email protected]>
13
#
14
# Distributed under the terms of the GNU General Public License (GPL)
15
#
16
# The full text of the GPL is available at:
17
#
18
# http://www.gnu.org/licenses/
19
##############################################################################
20
21
from sage.groups.group_homset import GroupHomset_generic
22
23
24
def is_MatrixGroupHomset(x):
25
r"""
26
Test whether ``x`` is a homset.
27
28
EXAMPLES::
29
30
sage: from sage.groups.matrix_gps.homset import is_MatrixGroupHomset
31
sage: is_MatrixGroupHomset(4)
32
False
33
34
sage: F = GF(5)
35
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
36
sage: G = MatrixGroup(gens)
37
sage: from sage.groups.matrix_gps.homset import MatrixGroupHomset
38
sage: M = MatrixGroupHomset(G, G)
39
sage: is_MatrixGroupHomset(M)
40
True
41
"""
42
return isinstance(x, MatrixGroupHomset)
43
44
45
class MatrixGroupHomset(GroupHomset_generic):
46
47
def __init__(self, G, H):
48
r"""
49
Return the homset of two matrix groups.
50
51
INPUT:
52
53
- ``G`` -- a matrix group.
54
55
- ``H`` -- a matrix group.
56
57
OUTPUT:
58
59
The homset of two matrix groups.
60
61
EXAMPLES::
62
63
sage: F = GF(5)
64
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
65
sage: G = MatrixGroup(gens)
66
sage: from sage.groups.matrix_gps.homset import MatrixGroupHomset
67
sage: MatrixGroupHomset(G, G)
68
Set of Homomorphisms from
69
Matrix group over Finite Field of size 5 with 2 generators (
70
[1 2] [1 1]
71
[4 1], [0 1]
72
) to Matrix group over Finite Field of size 5 with 2 generators (
73
[1 2] [1 1]
74
[4 1], [0 1]
75
)
76
"""
77
from sage.categories.groups import Groups
78
from sage.categories.homset import HomsetWithBase
79
HomsetWithBase.__init__(self, G, H, Groups(), G.base_ring())
80
81
def __call__(self, im_gens, check=True):
82
"""
83
Return the homomorphism defined by images of generators.
84
85
INPUT:
86
87
- ``im_gens`` -- iterable, the list of images of the
88
generators of the domain
89
90
- ``check`` -- bool (optional, default: ``True``), whether to
91
check if images define a valid homomorphism
92
93
OUTPUT:
94
95
Group homomorphism.
96
97
EXAMPLES::
98
99
sage: F = GF(5)
100
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
101
sage: G = MatrixGroup(gens)
102
sage: from sage.groups.matrix_gps.homset import MatrixGroupHomset
103
sage: M = MatrixGroupHomset(G, G)
104
sage: M(gens)
105
Homomorphism : Matrix group over Finite Field of size 5 with 2 generators (
106
[1 2] [1 1]
107
[4 1], [0 1]
108
) --> Matrix group over Finite Field of size 5 with 2 generators (
109
[1 2] [1 1]
110
[4 1], [0 1]
111
)
112
"""
113
from sage.groups.matrix_gps.morphism import MatrixGroupMorphism_im_gens
114
try:
115
return MatrixGroupMorphism_im_gens(self, im_gens, check=check)
116
except (NotImplementedError, ValueError) as err:
117
raise TypeError('images do not define a group homomorphism')
118
119
120
121