Skip to content

Commit

Permalink
gh-35306: sage.groups.matrix_gps: Modularization fixes for imports
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
### 📚 Description
We move the `...MatrixGroup_gap` classes to separate modules named
`..._gap`.

This is part of:
- #29705
<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes #1337" -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
- Depends on #35099
- Depends on #35119
    
URL: #35306
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee, Matthias Köppe
  • Loading branch information
Release Manager committed Apr 21, 2023
2 parents 8bcce63 + 1024a23 commit 55ebb79
Show file tree
Hide file tree
Showing 32 changed files with 2,726 additions and 2,461 deletions.
8 changes: 8 additions & 0 deletions src/doc/en/reference/groups/index.rst
Expand Up @@ -72,17 +72,24 @@ Matrix and Affine Groups

sage/groups/matrix_gps/catalog
sage/groups/matrix_gps/matrix_group
sage/groups/matrix_gps/matrix_group_gap
sage/groups/matrix_gps/group_element
sage/groups/matrix_gps/group_element_gap
sage/groups/matrix_gps/finitely_generated
sage/groups/matrix_gps/finitely_generated_gap
sage/groups/matrix_gps/morphism
sage/groups/matrix_gps/homset
sage/groups/matrix_gps/binary_dihedral
sage/groups/matrix_gps/coxeter_group
sage/groups/matrix_gps/linear
sage/groups/matrix_gps/linear_gap
sage/groups/matrix_gps/orthogonal
sage/groups/matrix_gps/orthogonal_gap
sage/groups/matrix_gps/isometries
sage/groups/matrix_gps/symplectic
sage/groups/matrix_gps/symplectic_gap
sage/groups/matrix_gps/unitary
sage/groups/matrix_gps/unitary_gap
sage/groups/matrix_gps/heisenberg
sage/groups/affine_gps/affine_group
sage/groups/affine_gps/euclidean_group
Expand Down Expand Up @@ -115,5 +122,6 @@ Internals
:maxdepth: 1

sage/groups/matrix_gps/named_group
sage/groups/matrix_gps/named_group_gap

.. include:: ../footer.txt
4 changes: 2 additions & 2 deletions src/sage/categories/primer.py
Expand Up @@ -524,12 +524,12 @@ class implements:
sage: G = GL(2,ZZ)
sage: type(G)
<class 'sage.groups.matrix_gps.linear.LinearMatrixGroup_gap_with_category'>
<class 'sage.groups.matrix_gps.linear_gap.LinearMatrixGroup_gap_with_category'>
Here is a piece of the hierarchy of classes above it::
sage: for cls in G.__class__.mro(): print(cls)
<class 'sage.groups.matrix_gps.linear.LinearMatrixGroup_gap_with_category'>
<class 'sage.groups.matrix_gps.linear_gap.LinearMatrixGroup_gap_with_category'>
...
<class 'sage.categories.groups.Groups.parent_class'>
<class 'sage.categories.monoids.Monoids.parent_class'>
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/root_system/weyl_group.py
Expand Up @@ -39,8 +39,8 @@
#
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.groups.matrix_gps.finitely_generated import FinitelyGeneratedMatrixGroup_gap
from sage.groups.matrix_gps.group_element import MatrixGroupElement_gap
from sage.groups.matrix_gps.finitely_generated_gap import FinitelyGeneratedMatrixGroup_gap
from sage.groups.matrix_gps.group_element_gap import MatrixGroupElement_gap
from sage.groups.perm_gps.permgroup import PermutationGroup_generic
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
Expand Down
88 changes: 41 additions & 47 deletions src/sage/groups/affine_gps/affine_group.py
Expand Up @@ -129,11 +129,11 @@ class AffineGroup(UniqueRepresentation, Group):
Some additional ways to create affine groups::
sage: A = AffineSpace(2, GF(4,'a')); A
sage: A = AffineSpace(2, GF(4,'a')); A # optional - sage.rings.finite_rings
Affine Space of dimension 2 over Finite Field in a of size 2^2
sage: G = AffineGroup(A); G
sage: G = AffineGroup(A); G # optional - sage.rings.finite_rings
Affine Group of degree 2 over Finite Field in a of size 2^2
sage: G is AffineGroup(2,4) # shorthand
sage: G is AffineGroup(2,4) # shorthand # optional - sage.rings.finite_rings
True
sage: V = ZZ^3; V
Expand All @@ -152,10 +152,10 @@ def __classcall__(cls, *args, **kwds):
EXAMPLES::
sage: A = AffineSpace(2, GF(4,'a'))
sage: AffineGroup(A) is AffineGroup(2,4)
sage: A = AffineSpace(2, GF(4,'a')) # optional - sage.rings.finite_rings
sage: AffineGroup(A) is AffineGroup(2,4) # optional - sage.rings.finite_rings
True
sage: AffineGroup(A) is AffineGroup(2, GF(4,'a'))
sage: AffineGroup(A) is AffineGroup(2, GF(4,'a')) # optional - sage.rings.finite_rings
True
sage: A = AffineGroup(2, QQ)
sage: V = QQ^2
Expand Down Expand Up @@ -202,10 +202,10 @@ def __init__(self, degree, ring):
TESTS::
sage: G = AffineGroup(2, GF(5)); G
sage: G = AffineGroup(2, GF(5)); G # optional - sage.rings.finite_rings
Affine Group of degree 2 over Finite Field of size 5
sage: TestSuite(G).run()
sage: G.category()
sage: TestSuite(G).run() # optional - sage.rings.finite_rings
sage: G.category() # optional - sage.rings.finite_rings
Category of finite groups
sage: Aff6 = AffineGroup(6, QQ)
Expand Down Expand Up @@ -264,8 +264,8 @@ def _latex_(self):
EXAMPLES::
sage: G = AffineGroup(6, GF(5))
sage: latex(G)
sage: G = AffineGroup(6, GF(5)) # optional - sage.rings.finite_rings
sage: latex(G) # optional - sage.rings.finite_rings
\mathrm{Aff}_{6}(\Bold{F}_{5})
"""
return "\\mathrm{Aff}_{%s}(%s)" % (self.degree(),
Expand All @@ -277,7 +277,7 @@ def _repr_(self):
EXAMPLES::
sage: AffineGroup(6, GF(5))
sage: AffineGroup(6, GF(5)) # optional - sage.rings.finite_rings
Affine Group of degree 6 over Finite Field of size 5
"""
return "Affine Group of degree %s over %s" % (self.degree(),
Expand All @@ -289,7 +289,7 @@ def cardinality(self):
EXAMPLES::
sage: AffineGroup(6, GF(5)).cardinality()
sage: AffineGroup(6, GF(5)).cardinality() # optional - sage.rings.finite_rings
172882428468750000000000000000
sage: AffineGroup(6, ZZ).cardinality()
+Infinity
Expand All @@ -301,17 +301,15 @@ def degree(self):
"""
Return the dimension of the affine space.
OUTPUT:
An integer.
OUTPUT: An integer.
EXAMPLES::
sage: G = AffineGroup(6, GF(5))
sage: g = G.an_element()
sage: G.degree()
sage: G = AffineGroup(6, GF(5)) # optional - sage.rings.finite_rings
sage: g = G.an_element() # optional - sage.rings.finite_rings
sage: G.degree() # optional - sage.rings.finite_rings
6
sage: G.degree() == g.A().nrows() == g.A().ncols() == g.b().degree()
sage: G.degree() == g.A().nrows() == g.A().ncols() == g.b().degree() # optional - sage.rings.finite_rings
True
"""
return self._degree
Expand All @@ -329,8 +327,8 @@ def matrix_space(self):
EXAMPLES::
sage: G = AffineGroup(3, GF(5))
sage: G.matrix_space()
sage: G = AffineGroup(3, GF(5)) # optional - sage.rings.finite_rings
sage: G.matrix_space() # optional - sage.rings.finite_rings
Full MatrixSpace of 3 by 3 dense matrices over Finite Field of size 5
"""
d = self.degree()
Expand All @@ -343,8 +341,8 @@ def vector_space(self):
EXAMPLES::
sage: G = AffineGroup(3, GF(5))
sage: G.vector_space()
sage: G = AffineGroup(3, GF(5)) # optional - sage.rings.finite_rings
sage: G.vector_space() # optional - sage.rings.finite_rings
Vector space of dimension 3 over Finite Field of size 5
"""
return FreeModule(self.base_ring(), self.degree())
Expand Down Expand Up @@ -373,8 +371,8 @@ def linear_space(self):
EXAMPLES::
sage: G = AffineGroup(3, GF(5))
sage: G.linear_space()
sage: G = AffineGroup(3, GF(5)) # optional - sage.rings.finite_rings
sage: G.linear_space() # optional - sage.rings.finite_rings
Full MatrixSpace of 4 by 4 dense matrices over Finite Field of size 5
"""
dp = self.degree() + 1
Expand All @@ -388,14 +386,12 @@ def linear(self, A):
- ``A`` -- anything that determines a matrix
OUTPUT:
The affine group element `x \mapsto A x`.
OUTPUT: The affine group element `x \mapsto A x`.
EXAMPLES::
sage: G = AffineGroup(3, GF(5))
sage: G.linear([1,2,3,4,5,6,7,8,0])
sage: G = AffineGroup(3, GF(5)) # optional - sage.rings.finite_rings
sage: G.linear([1,2,3,4,5,6,7,8,0]) # optional - sage.rings.finite_rings
[1 2 3] [0]
x |-> [4 0 1] x + [0]
[2 3 0] [0]
Expand All @@ -411,14 +407,12 @@ def translation(self, b):
- ``b`` -- anything that determines a vector
OUTPUT:
The affine group element `x \mapsto x + b`.
OUTPUT: The affine group element `x \mapsto x + b`.
EXAMPLES::
sage: G = AffineGroup(3, GF(5))
sage: G.translation([1,4,8])
sage: G = AffineGroup(3, GF(5)) # optional - sage.rings.finite_rings
sage: G.translation([1,4,8]) # optional - sage.rings.finite_rings
[1 0 0] [1]
x |-> [0 1 0] x + [4]
[0 0 1] [3]
Expand Down Expand Up @@ -446,12 +440,12 @@ def reflection(self, v):
EXAMPLES::
sage: G = AffineGroup(3, QQ)
sage: G.reflection([1,0,0])
sage: G = AffineGroup(3, QQ) # optional - sage.rings.finite_rings
sage: G.reflection([1,0,0]) # optional - sage.rings.finite_rings
[-1 0 0] [0]
x |-> [ 0 1 0] x + [0]
[ 0 0 1] [0]
sage: G.reflection([3,4,-5])
sage: G.reflection([3,4,-5]) # optional - sage.rings.finite_rings
[ 16/25 -12/25 3/5] [0]
x |-> [-12/25 9/25 4/5] x + [0]
[ 3/5 4/5 0] [0]
Expand All @@ -470,13 +464,13 @@ def random_element(self):
EXAMPLES::
sage: G = AffineGroup(4, GF(3))
sage: G.random_element() # random
sage: G = AffineGroup(4, GF(3)) # optional - sage.rings.finite_rings
sage: G.random_element() # random # optional - sage.rings.finite_rings
[2 0 1 2] [1]
[2 1 1 2] [2]
x |-> [1 0 2 2] x + [2]
[1 1 1 1] [2]
sage: G.random_element() in G
sage: G.random_element() in G # optional - sage.rings.finite_rings
True
"""
A = self._GL.random_element()
Expand All @@ -490,8 +484,8 @@ def _an_element_(self):
TESTS::
sage: G = AffineGroup(4,5)
sage: G.an_element() in G
sage: G = AffineGroup(4,5) # optional - sage.rings.finite_rings
sage: G.an_element() in G # optional - sage.rings.finite_rings
True
"""
A = self._GL.an_element()
Expand All @@ -504,8 +498,8 @@ def some_elements(self):
EXAMPLES::
sage: G = AffineGroup(4,5)
sage: G.some_elements()
sage: G = AffineGroup(4,5) # optional - sage.rings.finite_rings
sage: G.some_elements() # optional - sage.rings.finite_rings
[ [2 0 0 0] [1]
[0 1 0 0] [0]
x |-> [0 0 1 0] x + [0]
Expand All @@ -518,7 +512,7 @@ def some_elements(self):
[0 1 0 0] [...]
x |-> [0 0 1 0] x + [...]
[0 0 0 1] [...]]
sage: all(v.parent() is G for v in G.some_elements())
sage: all(v.parent() is G for v in G.some_elements()) # optional - sage.rings.finite_rings
True
sage: G = AffineGroup(2,QQ)
Expand Down
26 changes: 13 additions & 13 deletions src/sage/groups/affine_gps/euclidean_group.py
Expand Up @@ -21,7 +21,7 @@

class EuclideanGroup(AffineGroup):
r"""
an Euclidean group.
A Euclidean group.
The Euclidean group `E(A)` (or general affine group) of an affine
space `A` is the group of all invertible affine transformations from
Expand Down Expand Up @@ -121,11 +121,11 @@ class EuclideanGroup(AffineGroup):
Some additional ways to create Euclidean groups::
sage: A = AffineSpace(2, GF(4,'a')); A
sage: A = AffineSpace(2, GF(4,'a')); A # optional - sage.rings.finite_rings
Affine Space of dimension 2 over Finite Field in a of size 2^2
sage: G = EuclideanGroup(A); G
sage: G = EuclideanGroup(A); G # optional - sage.rings.finite_rings
Euclidean Group of degree 2 over Finite Field in a of size 2^2
sage: G is EuclideanGroup(2,4) # shorthand
sage: G is EuclideanGroup(2,4) # shorthand # optional - sage.rings.finite_rings
True
sage: V = ZZ^3; V
Expand All @@ -144,9 +144,9 @@ class EuclideanGroup(AffineGroup):
sage: V = QQ^6
sage: E6 is EuclideanGroup(V)
True
sage: G = EuclideanGroup(2, GF(5)); G
sage: G = EuclideanGroup(2, GF(5)); G # optional - sage.rings.finite_rings
Euclidean Group of degree 2 over Finite Field of size 5
sage: TestSuite(G).run()
sage: TestSuite(G).run() # optional - sage.rings.finite_rings
REFERENCES:
Expand Down Expand Up @@ -195,8 +195,8 @@ def _latex_(self):
r"""
EXAMPLES::
sage: G = EuclideanGroup(6, GF(5))
sage: latex(G)
sage: G = EuclideanGroup(6, GF(5)) # optional - sage.rings.finite_rings
sage: latex(G) # optional - sage.rings.finite_rings
\mathrm{E}_{6}(\Bold{F}_{5})
"""
return "\\mathrm{E}_{%s}(%s)"%(self.degree(), self.base_ring()._latex_())
Expand All @@ -207,7 +207,7 @@ def _repr_(self):
EXAMPLES::
sage: EuclideanGroup(6, GF(5))
sage: EuclideanGroup(6, GF(5)) # optional - sage.rings.finite_rings
Euclidean Group of degree 6 over Finite Field of size 5
"""
return "Euclidean Group of degree %s over %s"%(self.degree(), self.base_ring())
Expand All @@ -218,18 +218,18 @@ def random_element(self):
EXAMPLES::
sage: G = EuclideanGroup(4, GF(3))
sage: G.random_element() # random
sage: G = EuclideanGroup(4, GF(3)) # optional - sage.rings.finite_rings
sage: G.random_element() # random # optional - sage.rings.finite_rings
[2 1 2 1] [1]
[1 2 2 1] [0]
x |-> [2 2 2 2] x + [1]
[1 1 2 2] [2]
sage: G.random_element() in G
sage: G.random_element() in G # optional - sage.rings.finite_rings
True
TESTS::
sage: G.random_element().A().is_unitary()
sage: G.random_element().A().is_unitary() # optional - sage.rings.finite_rings
True
"""
while True:
Expand Down

0 comments on commit 55ebb79

Please sign in to comment.