Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.groups, sage.rings.number_field: Modularization fixes, # needs #36865

Merged
merged 23 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9373d14
src/sage/groups/{affine,matrix}_gps: Update # needs
mkoeppe Sep 3, 2023
918545d
src/sage/groups/group.pyx: Update # needs
mkoeppe Sep 3, 2023
d6c98e3
src/sage/groups/matrix_gps: Update # needs
mkoeppe Sep 4, 2023
fd6921a
sage.groups: Fix # needs
mkoeppe Sep 5, 2023
ebf9bf6
sage.{crypto.lattice,modules,quadratic_forms,groups}: Update # needs
mkoeppe Sep 9, 2023
ec1d448
sage.libs.gap, sage.groups: Update # needs
mkoeppe Sep 12, 2023
43144fe
src/sage/groups/pari_group.py: Use lazy_import
mkoeppe Sep 12, 2023
50a6d3c
sage.groups: Update # needs
mkoeppe Sep 12, 2023
7f78eda
src/sage/groups/galois_group_perm.py: Split out from src/sage/groups/…
mkoeppe Dec 14, 2023
c282b09
sage.knots, sage.groups.braid: Modularization fixes
mkoeppe Sep 19, 2023
d2c6b98
src/sage/groups/galois_group.py: Add # needs
mkoeppe Sep 20, 2023
390ecf5
sage.features: Add feature sage.libs.braiding
mkoeppe Sep 23, 2023
9966c86
sage.rings: Update # needs
mkoeppe Sep 24, 2023
ca23aff
sage.groups.matrix_gps: Add # needs
mkoeppe Sep 24, 2023
a96c0e7
sage.groups: Update # needs
mkoeppe Sep 25, 2023
087d1ec
sage -fixdoctests src/sage/groups
mkoeppe Dec 12, 2023
46ae4f8
src/sage/groups/matrix_gps/matrix_group.py: Fix # needs
mkoeppe Dec 12, 2023
42f0a14
src/sage/rings/number_field/galois_group.py: Fix import
mkoeppe Dec 12, 2023
f683312
src/sage/rings/number_field/number_field.py: Fix # needs
mkoeppe Dec 12, 2023
abdd256
src/sage/groups/matrix_gps/coxeter_group.py: Fix # needs for UCF
mkoeppe Dec 12, 2023
858db02
src/sage/groups/abelian_gps/dual_abelian_group*.py: Add file-level # …
mkoeppe Dec 12, 2023
899fdf7
src/sage/groups/galois_group_perm.py: Remove 'sage_setup: distribution'
mkoeppe Dec 12, 2023
1d77a49
Fix # needs
mkoeppe Dec 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sage/crypto/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def gen_lattice(type='modular', n=4, m=8, q=11, seed=None,
[-4 -3 2 -5 0 0 0 0 0 1]
]

sage: sage.crypto.gen_lattice(m=10, q=11, seed=42, lattice=True)
sage: sage.crypto.gen_lattice(m=10, q=11, seed=42, lattice=True) # needs fpylll
Free module of degree 10 and rank 10 over Integer Ring
User basis matrix:
[ 0 0 1 1 0 -1 -1 -1 1 0]
Expand Down
27 changes: 26 additions & 1 deletion src/sage/features/sagemath.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,29 @@ def __init__(self):
spkg='sagemath_groups', type='standard')


class sage__libs__braiding(PythonModule):
r"""
A :class:`~sage.features.Feature` describing the presence of :mod:`sage.libs.braiding`.

EXAMPLES::

sage: from sage.features.sagemath import sage__libs__braiding
sage: sage__libs__braiding().is_present() # needs sage.libs.braiding
FeatureTestResult('sage.libs.braiding', True)
"""

def __init__(self):
r"""
TESTS::

sage: from sage.features.sagemath import sage__libs__braiding
sage: isinstance(sage__libs__braiding(), sage__libs__braiding)
True
"""
PythonModule.__init__(self, 'sage.libs.braiding',
spkg='sagemath_libbraiding', type='standard')


class sage__libs__ecl(PythonModule):
r"""
A :class:`~sage.features.Feature` describing the presence of :mod:`sage.libs.ecl`.
Expand All @@ -330,7 +353,8 @@ def __init__(self):
sage: isinstance(sage__libs__ecl(), sage__libs__ecl)
True
"""
PythonModule.__init__(self, 'sage.libs.ecl')
PythonModule.__init__(self, 'sage.libs.ecl',
spkg='sagemath_symbolics', type='standard')


class sage__libs__flint(JoinFeature):
Expand Down Expand Up @@ -1076,6 +1100,7 @@ def all_features():
sage__geometry__polyhedron(),
sage__graphs(),
sage__groups(),
sage__libs__braiding(),
sage__libs__ecl(),
sage__libs__flint(),
sage__libs__gap(),
Expand Down
56 changes: 27 additions & 29 deletions src/sage/groups/abelian_gps/dual_abelian_group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.rings.number_field
r"""
Dual groups of Finite Multiplicative Abelian Groups

Expand Down Expand Up @@ -25,7 +26,6 @@
sage: F = AbelianGroup(5, [2,5,7,8,9], names='abcde')
sage: (a, b, c, d, e) = F.gens()

sage: # needs sage.rings.number_field
sage: Fd = F.dual_group(names='ABCDE')
sage: Fd.base_ring()
Cyclotomic Field of order 2520 and degree 576
Expand Down Expand Up @@ -82,7 +82,6 @@ def is_DualAbelianGroup(x):

EXAMPLES::

sage: # needs sage.rings.number_field
sage: from sage.groups.abelian_gps.dual_abelian_group import is_DualAbelianGroup
sage: F = AbelianGroup(5,[3,5,7,8,9], names=list("abcde"))
sage: Fd = F.dual_group()
Expand All @@ -105,7 +104,7 @@ class DualAbelianGroup_class(UniqueRepresentation, AbelianGroupBase):
EXAMPLES::

sage: F = AbelianGroup(5,[3,5,7,8,9], names="abcde")
sage: F.dual_group() # needs sage.rings.number_field
sage: F.dual_group()
Dual of Abelian Group isomorphic to Z/3Z x Z/5Z x Z/7Z x Z/8Z x Z/9Z
over Cyclotomic Field of order 2520 and degree 576

Expand All @@ -123,7 +122,7 @@ def __init__(self, G, names, base_ring):
EXAMPLES::

sage: F = AbelianGroup(5,[3,5,7,8,9], names="abcde")
sage: F.dual_group() # needs sage.rings.number_field
sage: F.dual_group()
Dual of Abelian Group isomorphic to Z/3Z x Z/5Z x Z/7Z x Z/8Z x Z/9Z
over Cyclotomic Field of order 2520 and degree 576
"""
Expand Down Expand Up @@ -180,9 +179,9 @@ def _repr_(self):
EXAMPLES::

sage: F = AbelianGroup(5, [2,5,7,8,9], names='abcde')
sage: Fd = F.dual_group(names='ABCDE', # needs sage.rings.number_field
sage: Fd = F.dual_group(names='ABCDE',
....: base_ring=CyclotomicField(2*5*7*8*9))
sage: Fd # indirect doctest # needs sage.rings.number_field
sage: Fd # indirect doctest
Dual of Abelian Group isomorphic to Z/2Z x Z/5Z x Z/7Z x Z/8Z x Z/9Z
over Cyclotomic Field of order 5040 and degree 1152
sage: Fd = F.dual_group(names='ABCDE', base_ring=CC) # needs sage.rings.real_mpfr
Expand All @@ -209,8 +208,8 @@ def _latex_(self):
EXAMPLES::

sage: F = AbelianGroup(3, [2]*3)
sage: Fd = F.dual_group() # needs sage.rings.number_field
sage: Fd._latex_() # needs sage.rings.number_field
sage: Fd = F.dual_group()
sage: Fd._latex_()
'$\\mathrm{DualAbelianGroup}( AbelianGroup ( 3, (2, 2, 2) ) )$'
"""
return r"$\mathrm{DualAbelianGroup}( AbelianGroup ( %s, %s ) )$" % (self.ngens(), self.gens_orders())
Expand Down Expand Up @@ -251,7 +250,6 @@ def gen(self, i=0):

EXAMPLES::

sage: # needs sage.rings.number_field
sage: F = AbelianGroup(3, [1,2,3], names='a')
sage: Fd = F.dual_group(names="A")
sage: Fd.0
Expand Down Expand Up @@ -279,8 +277,8 @@ def gens(self):

EXAMPLES::

sage: F = AbelianGroup([7,11]).dual_group() # needs sage.rings.number_field
sage: F.gens() # needs sage.rings.number_field
sage: F = AbelianGroup([7,11]).dual_group()
sage: F.gens()
(X0, X1)
"""
n = self.group().ngens()
Expand All @@ -293,8 +291,8 @@ def ngens(self):
EXAMPLES::

sage: F = AbelianGroup([7]*100)
sage: Fd = F.dual_group() # needs sage.rings.number_field
sage: Fd.ngens() # needs sage.rings.number_field
sage: Fd = F.dual_group()
sage: Fd.ngens()
100
"""
return self.group().ngens()
Expand All @@ -310,8 +308,8 @@ def gens_orders(self):
EXAMPLES::

sage: F = AbelianGroup([5]*1000)
sage: Fd = F.dual_group() # needs sage.rings.number_field
sage: invs = Fd.gens_orders(); len(invs) # needs sage.rings.number_field
sage: Fd = F.dual_group()
sage: invs = Fd.gens_orders(); len(invs)
1000
"""
return self.group().gens_orders()
Expand All @@ -325,8 +323,8 @@ def invariants(self):
EXAMPLES::

sage: F = AbelianGroup([5]*1000)
sage: Fd = F.dual_group() # needs sage.rings.number_field
sage: invs = Fd.gens_orders(); len(invs) # needs sage.rings.number_field
sage: Fd = F.dual_group()
sage: invs = Fd.gens_orders(); len(invs)
1000
"""
# TODO: deprecate
Expand All @@ -340,9 +338,9 @@ def __contains__(self, X):

sage: F = AbelianGroup(5,[2, 3, 5, 7, 8], names="abcde")
sage: a,b,c,d,e = F.gens()
sage: Fd = F.dual_group(names="ABCDE") # needs sage.rings.number_field
sage: A,B,C,D,E = Fd.gens() # needs sage.rings.number_field
sage: A*B^2*D^7 in Fd # needs sage.rings.number_field
sage: Fd = F.dual_group(names="ABCDE")
sage: A,B,C,D,E = Fd.gens()
sage: A*B^2*D^7 in Fd
True
"""
return X.parent() == self and is_DualAbelianGroupElement(X)
Expand All @@ -354,8 +352,8 @@ def order(self):
EXAMPLES::

sage: G = AbelianGroup([2,3,9])
sage: Gd = G.dual_group() # needs sage.rings.number_field
sage: Gd.order() # needs sage.rings.number_field
sage: Gd = G.dual_group()
sage: Gd.order()
54
"""
G = self.group()
Expand All @@ -368,10 +366,10 @@ def is_commutative(self):
EXAMPLES::

sage: G = AbelianGroup([2,3,9])
sage: Gd = G.dual_group() # needs sage.rings.number_field
sage: Gd.is_commutative() # needs sage.rings.number_field
sage: Gd = G.dual_group()
sage: Gd.is_commutative()
True
sage: Gd.is_abelian() # needs sage.rings.number_field
sage: Gd.is_abelian()
True
"""
return True
Expand All @@ -384,8 +382,8 @@ def list(self):
EXAMPLES::

sage: G = AbelianGroup([2,3], names="ab")
sage: Gd = G.dual_group(names="AB") # needs sage.rings.number_field
sage: Gd.list() # needs sage.rings.number_field
sage: Gd = G.dual_group(names="AB")
sage: Gd.list()
(1, B, B^2, A, A*B, A*B^2)
"""
if not self.is_finite():
Expand All @@ -400,8 +398,8 @@ def __iter__(self):
EXAMPLES::

sage: G = AbelianGroup([2,3], names="ab")
sage: Gd = G.dual_group(names="AB") # needs sage.rings.number_field
sage: [X for X in Gd] # needs sage.rings.number_field
sage: Gd = G.dual_group(names="AB")
sage: [X for X in Gd]
[1, B, B^2, A, A*B, A*B^2]

sage: # needs sage.rings.real_mpfr
Expand Down
14 changes: 6 additions & 8 deletions src/sage/groups/abelian_gps/dual_abelian_group_element.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.rings.number_field
"""
Elements (characters) of the dual group of a finite Abelian group

Expand All @@ -8,13 +9,12 @@
sage: F
Multiplicative Abelian group isomorphic to C2 x C3 x C5 x C7 x C8

sage: Fd = F.dual_group(names="ABCDE"); Fd # needs sage.rings.number_field
sage: Fd = F.dual_group(names="ABCDE"); Fd
Dual of Abelian Group isomorphic to Z/2Z x Z/3Z x Z/5Z x Z/7Z x Z/8Z
over Cyclotomic Field of order 840 and degree 192

The elements of the dual group can be evaluated on elements of the original group::

sage: # needs sage.rings.number_field
sage: a,b,c,d,e = F.gens()
sage: A,B,C,D,E = Fd.gens()
sage: A*B^2*D^7
Expand Down Expand Up @@ -71,10 +71,10 @@ def is_DualAbelianGroupElement(x) -> bool:
EXAMPLES::

sage: from sage.groups.abelian_gps.dual_abelian_group import is_DualAbelianGroupElement
sage: F = AbelianGroup(5, [5,5,7,8,9], names=list("abcde")).dual_group() # needs sage.rings.number_field
sage: is_DualAbelianGroupElement(F) # needs sage.rings.number_field
sage: F = AbelianGroup(5, [5,5,7,8,9], names=list("abcde")).dual_group()
sage: is_DualAbelianGroupElement(F)
False
sage: is_DualAbelianGroupElement(F.an_element()) # needs sage.rings.number_field
sage: is_DualAbelianGroupElement(F.an_element())
True
"""
return isinstance(x, DualAbelianGroupElement)
Expand All @@ -96,7 +96,6 @@ def __call__(self, g):

EXAMPLES::

sage: # needs sage.rings.number_field
sage: F = AbelianGroup(5, [2,3,5,7,8], names="abcde")
sage: a,b,c,d,e = F.gens()
sage: Fd = F.dual_group(names="ABCDE")
Expand Down Expand Up @@ -147,7 +146,6 @@ def word_problem(self, words):

EXAMPLES::

sage: # needs sage.rings.number_field
sage: G = AbelianGroup(5,[3, 5, 5, 7, 8], names="abcde")
sage: Gd = G.dual_group(names="abcde")
sage: a,b,c,d,e = Gd.gens()
Expand All @@ -156,7 +154,7 @@ def word_problem(self, words):
sage: w = a^7*b^3*c^5*d^4*e^4
sage: x = a^3*b^2*c^2*d^3*e^5
sage: y = a^2*b^4*c^2*d^4*e^5
sage: e.word_problem([u,v,w,x,y])
sage: e.word_problem([u,v,w,x,y]) # needs sage.libs.gap
[[b^2*c^2*d^3*e^5, 245]]
"""
from sage.libs.gap.libgap import libgap
Expand Down
7 changes: 7 additions & 0 deletions src/sage/groups/affine_gps/affine_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ def __init__(self, degree, ring):

sage: G = AffineGroup(2, GF(5)); G
Affine Group of degree 2 over Finite Field of size 5

sage: # needs sage.libs.gap (for gens)
sage: TestSuite(G).run()

sage: G.category()
Category of finite groups

Expand Down Expand Up @@ -289,8 +292,10 @@ def cardinality(self):

EXAMPLES::

sage: # needs sage.libs.gap
sage: AffineGroup(6, GF(5)).cardinality()
172882428468750000000000000000

sage: AffineGroup(6, ZZ).cardinality()
+Infinity
"""
Expand Down Expand Up @@ -464,6 +469,7 @@ def random_element(self):

EXAMPLES::

sage: # needs sage.libs.gap
sage: G = AffineGroup(4, GF(3))
sage: G.random_element() # random
[2 0 1 2] [1]
Expand Down Expand Up @@ -498,6 +504,7 @@ def some_elements(self):

EXAMPLES::

sage: # needs sage.libs.gap
sage: G = AffineGroup(4,5)
sage: G.some_elements()
[ [2 0 0 0] [1]
Expand Down
2 changes: 2 additions & 0 deletions src/sage/groups/affine_gps/euclidean_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ class EuclideanGroup(AffineGroup):
True
sage: G = EuclideanGroup(2, GF(5)); G
Euclidean Group of degree 2 over Finite Field of size 5

sage: # needs sage.libs.gap (for gens)
sage: TestSuite(G).run()

REFERENCES:
Expand Down
5 changes: 5 additions & 0 deletions src/sage/groups/affine_gps/group_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ class AffineGroupElement(MultiplicativeGroupElement):
EXAMPLES::

sage: G = AffineGroup(2, GF(3))

sage: # needs sage.libs.gap
sage: g = G.random_element()
sage: type(g)
<class 'sage.groups.affine_gps.affine_group.AffineGroup_with_category.element_class'>
sage: G(g.matrix()) == g
True

sage: G(2)
[2 0] [0]
x |-> [0 2] x + [0]
Expand All @@ -107,6 +110,7 @@ def __init__(self, parent, A, b=0, convert=True, check=True):

TESTS::

sage: # needs sage.libs.gap
sage: G = AffineGroup(4, GF(5))
sage: g = G.random_element()
sage: TestSuite(g).run()
Expand Down Expand Up @@ -200,6 +204,7 @@ def matrix(self):
Composition of affine group elements equals multiplication of
the matrices::

sage: # needs sage.libs.gap
sage: g1 = G.random_element()
sage: g2 = G.random_element()
sage: g1.matrix() * g2.matrix() == (g1*g2).matrix()
Expand Down
6 changes: 3 additions & 3 deletions src/sage/groups/braid.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@
from sage.combinat.permutation import Permutation
from sage.combinat.permutation import Permutations
from sage.combinat.subset import Subsets
from sage.features import PythonModule
from sage.features.sagemath import sage__libs__braiding
from sage.groups.artin import FiniteTypeArtinGroup, FiniteTypeArtinGroupElement
from sage.groups.finitely_presented import FinitelyPresentedGroup
from sage.groups.finitely_presented import GroupMorphismWithGensImages
from sage.groups.free_group import FreeGroup, is_FreeGroup
from sage.functions.generalized import sign
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
from sage.groups.perm_gps.permgroup_named import SymmetricGroupElement
from sage.knots.knot import Knot
from sage.libs.gap.libgap import libgap
from sage.matrix.constructor import identity_matrix, matrix
from sage.misc.lazy_attribute import lazy_attribute
Expand All @@ -98,7 +97,8 @@
['leftnormalform', 'rightnormalform', 'centralizer', 'supersummitset', 'greatestcommondivisor',
'leastcommonmultiple', 'conjugatingbraid', 'ultrasummitset',
'thurston_type', 'rigidity', 'sliding_circuits'],
feature=PythonModule('sage.libs.braiding', spkg='libbraiding', type='standard'))
feature=sage__libs__braiding())
lazy_import('sage.knots.knot', 'Knot')


class Braid(FiniteTypeArtinGroupElement):
Expand Down
Loading
Loading