Skip to content

Commit 3de6e29

Browse files
author
Release Manager
committed
gh-36259: `sage.rings.padics`: Update `# needs` <!-- ^^^^^ 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" --> <!-- Describe your changes here in detail --> Another update of `# needs` in `sage.rings`, with a focus on `sage.rings.padics`. In #35095, the distributions **sagemath-pari**, **sagemath-ntl**, **sagemath-flint**, and **sagemath-linbox** now provide p-adic rings. The feature `sage.rings.padics` covers the common rings implemented using PARI and NTL. Additional rings are provided using FLINT. Cherry-picked from #35095. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 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! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36259 Reported by: Matthias Köppe Reviewer(s): David Coudert, Kwankyu Lee, Matthias Köppe
2 parents a901ccc + 5e4ea11 commit 3de6e29

File tree

128 files changed

+2772
-2208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2772
-2208
lines changed

src/sage/features/sagemath.py

+28-9
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,28 @@ def __init__(self):
389389
"""
390390
JoinFeature.__init__(self, 'sage.libs.gap',
391391
[PythonModule('sage.libs.gap.libgap'),
392-
PythonModule('sage.interfaces.gap')])
392+
PythonModule('sage.interfaces.gap'),
393+
PythonModule('sage.groups.matrix_gps.finitely_generated_gap'),
394+
PythonModule('sage.groups.matrix_gps.group_element_gap'),
395+
PythonModule('sage.groups.matrix_gps.heisenberg'),
396+
PythonModule('sage.groups.matrix_gps.isometries'),
397+
PythonModule('sage.groups.matrix_gps.linear_gap'),
398+
PythonModule('sage.groups.matrix_gps.matrix_group_gap'),
399+
PythonModule('sage.groups.matrix_gps.named_group_gap'),
400+
PythonModule('sage.groups.matrix_gps.orthogonal_gap'),
401+
PythonModule('sage.groups.matrix_gps.symplectic_gap'),
402+
PythonModule('sage.groups.matrix_gps.unitary_gap'),
403+
PythonModule('sage.matrix.matrix_gap'),
404+
PythonModule('sage.rings.universal_cyclotomic_field')])
393405

394406

395407
class sage__libs__linbox(JoinFeature):
396408
r"""
397409
A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.linbox`
398410
and other modules depending on Givaro, FFLAS-FFPACK, LinBox.
399411
400-
In addition to the modularization purposes that this tag serves,
401-
it also provides attribution to the upstream project.
412+
In addition to the modularization purposes that this tag serves, it also provides attribution
413+
to the upstream project.
402414
403415
TESTS::
404416
@@ -415,7 +427,9 @@ def __init__(self):
415427
True
416428
"""
417429
JoinFeature.__init__(self, 'sage.libs.linbox',
418-
[PythonModule('sage.rings.finite_rings.element_givaro')],
430+
[PythonModule('sage.rings.finite_rings.element_givaro'),
431+
PythonModule('sage.matrix.matrix_modn_dense_float'),
432+
PythonModule('sage.matrix.matrix_modn_dense_double')],
419433
spkg='sagemath_linbox', type='standard')
420434

421435

@@ -442,7 +456,8 @@ def __init__(self):
442456
True
443457
"""
444458
JoinFeature.__init__(self, 'sage.libs.m4ri',
445-
[PythonModule('sage.matrix.matrix_gf2e_dense')],
459+
[PythonModule('sage.matrix.matrix_gf2e_dense'),
460+
PythonModule('sage.matrix.matrix_mod2_dense')],
446461
spkg='sagemath_m4ri', type='standard')
447462

448463

@@ -708,7 +723,8 @@ def __init__(self):
708723
"""
709724
JoinFeature.__init__(self, 'sage.rings.finite_rings',
710725
[PythonModule('sage.rings.finite_rings.element_pari_ffelt'),
711-
PythonModule('sage.rings.algebraic_closure_finite_field')],
726+
PythonModule('sage.rings.algebraic_closure_finite_field'),
727+
sage__libs__pari()],
712728
type='standard')
713729

714730

@@ -784,16 +800,19 @@ class sage__rings__number_field(JoinFeature):
784800
sage: CC(zeta)
785801
0.913545457642601 + 0.406736643075800*I
786802
787-
Doctests that make use of the algebraic field ``QQbar``, the algebraic real field ``AA``,
788-
or the universal cyclotomic field should be marked likewise::
803+
Doctests that make use of the algebraic field ``QQbar`` or the algebraic real field ``AA``
804+
should be marked likewise::
789805
790806
sage: # needs sage.rings.number_field
791807
sage: AA(-1)^(1/3)
792808
-1
793809
sage: QQbar(-1)^(1/3)
794810
0.500000000000000? + 0.866025403784439?*I
795811
796-
sage: # needs sage.rings.number_field
812+
Use of the universal cyclotomic field should be marked
813+
``# needs sage.libs.gap sage.rings.number_field``.
814+
815+
sage: # needs sage.libs.gap sage.rings.number_field
797816
sage: UCF = UniversalCyclotomicField(); UCF
798817
Universal Cyclotomic Field
799818
sage: E = UCF.gen

src/sage/rings/abc.pyx

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ class UniversalCyclotomicField(Field):
6666
EXAMPLES::
6767
6868
sage: import sage.rings.abc
69-
sage: K = UniversalCyclotomicField() # needs sage.rings.number_field
70-
sage: isinstance(K, sage.rings.abc.UniversalCyclotomicField) # needs sage.rings.number_field
69+
sage: K = UniversalCyclotomicField() # needs sage.libs.gap sage.rings.number_field
70+
sage: isinstance(K, sage.rings.abc.UniversalCyclotomicField) # needs sage.libs.gap sage.rings.number_field
7171
True
7272
7373
By design, there is a unique direct subclass::
7474
75-
sage: sage.rings.abc.UniversalCyclotomicField.__subclasses__() # needs sage.rings.number_field
75+
sage: sage.rings.abc.UniversalCyclotomicField.__subclasses__() # needs sage.libs.gap sage.rings.number_field
7676
[<class 'sage.rings.universal_cyclotomic_field.UniversalCyclotomicField'>]
7777
7878
sage: len(sage.rings.abc.NumberField_cyclotomic.__subclasses__()) <= 1

src/sage/rings/complex_arb.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4014,7 +4014,7 @@ cdef class ComplexBall(RingElement):
40144014
[2.2882956833435e+50 +/- ...e+36],
40154015
[1.2807602335816e+51 +/- ...e+37])
40164016
sage: ai, aip, bi, bip = CBF(1,2).airy()
4017-
sage: (ai * bip - bi * aip) * CBF(pi)
4017+
sage: (ai * bip - bi * aip) * CBF(pi) # needs sage.symbolic
40184018
[1.0000000000000 +/- ...e-15] + [+/- ...e-16]*I
40194019
40204020
"""

src/sage/rings/complex_double.pyx

+7-6
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,11 @@ cdef class ComplexDoubleElement(FieldElement):
796796
797797
EXAMPLES::
798798
799-
sage: CDF(1.2) > CDF(i)
799+
sage: CDF(1.2) > CDF(i) # needs sage.symbolic
800800
True
801801
sage: CDF(1) < CDF(2)
802802
True
803-
sage: CDF(1 + i) > CDF(-1 - i)
803+
sage: CDF(1 + i) > CDF(-1 - i) # needs sage.symbolic
804804
True
805805
806806
::
@@ -2551,11 +2551,12 @@ cdef class ComplexToCDF(Morphism):
25512551
25522552
EXAMPLES::
25532553
2554-
sage: import numpy # needs numpy
2555-
sage: f = CDF.coerce_map_from(numpy.complex_) # needs numpy
2556-
sage: f(numpy.complex_(I)) # needs numpy
2554+
sage: # needs numpy
2555+
sage: import numpy
2556+
sage: f = CDF.coerce_map_from(numpy.complex_)
2557+
sage: f(numpy.complex_(I))
25572558
1.0*I
2558-
sage: f(numpy.complex_(I)).parent() # needs numpy
2559+
sage: f(numpy.complex_(I)).parent()
25592560
Complex Double Field
25602561
"""
25612562
def __init__(self, R):

src/sage/rings/complex_interval_field.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -484,19 +484,19 @@ def _coerce_map_from_(self, S):
484484
Coercion map:
485485
From: Set of Python objects of class 'int'
486486
To: Complex Interval Field with 53 bits of precision
487-
sage: CIF.coerce_map_from(GaussianIntegers())
487+
sage: CIF.coerce_map_from(GaussianIntegers()) # needs sage.rings.number_field
488488
Conversion via _complex_mpfi_ method map:
489489
From: Gaussian Integers in Number Field in I with defining polynomial x^2 + 1 with I = 1*I
490490
To: Complex Interval Field with 53 bits of precision
491-
sage: CIF.coerce_map_from(QQbar)
491+
sage: CIF.coerce_map_from(QQbar) # needs sage.rings.number_field
492492
Conversion via _complex_mpfi_ method map:
493493
From: Algebraic Field
494494
To: Complex Interval Field with 53 bits of precision
495-
sage: CIF.coerce_map_from(AA)
495+
sage: CIF.coerce_map_from(AA) # needs sage.rings.number_field
496496
Conversion via _complex_mpfi_ method map:
497497
From: Algebraic Real Field
498498
To: Complex Interval Field with 53 bits of precision
499-
sage: CIF.coerce_map_from(UniversalCyclotomicField())
499+
sage: CIF.coerce_map_from(UniversalCyclotomicField()) # needs sage.libs.gap sage.rings.number_field
500500
Conversion via _complex_mpfi_ method map:
501501
From: Universal Cyclotomic Field
502502
To: Complex Interval Field with 53 bits of precision
@@ -532,9 +532,9 @@ def _repr_(self):
532532
533533
EXAMPLES::
534534
535-
sage: ComplexIntervalField() # indirect doctest
535+
sage: ComplexIntervalField() # indirect doctest
536536
Complex Interval Field with 53 bits of precision
537-
sage: ComplexIntervalField(100) # indirect doctest
537+
sage: ComplexIntervalField(100) # indirect doctest
538538
Complex Interval Field with 100 bits of precision
539539
"""
540540
return "Complex Interval Field with %s bits of precision" % self._prec

src/sage/rings/continued_fraction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
158158
Nevertheless, the tail is preserved under invertible integer homographies::
159159
160-
sage: # needs sage.rings.number_field
160+
sage: # needs sage.modular sage.rings.number_field
161161
sage: apply_homography = lambda m,z: (m[0,0]*z + m[0,1]) / (m[1,0]*z + m[1,1])
162162
sage: m1 = SL2Z([60,13,83,18])
163163
sage: m2 = SL2Z([27,80,28,83])

src/sage/rings/derivation.py

+13-16
Original file line numberDiff line numberDiff line change
@@ -1580,16 +1580,15 @@ def __init__(self, parent, arg=None):
15801580
15811581
TESTS::
15821582
1583-
sage: # needs sage.rings.finite_rings
1583+
sage: # needs sage.libs.singular
15841584
sage: from sage.rings.derivation import RingDerivationWithoutTwist_wrapper
15851585
sage: R.<x,y> = GF(5)[]
15861586
sage: S = R.quo([x^5, y^5])
15871587
sage: M = S.derivation_module()
15881588
sage: der = M.random_element()
15891589
sage: isinstance(der, RingDerivationWithoutTwist_wrapper)
15901590
True
1591-
1592-
sage: TestSuite(der).run() # needs sage.rings.finite_rings
1591+
sage: TestSuite(der).run()
15931592
15941593
"""
15951594
if isinstance(arg, list) and len(arg) == 1 and isinstance(arg[0], RingDerivation):
@@ -1620,7 +1619,7 @@ def _add_(self, other):
16201619
16211620
EXAMPLES::
16221621
1623-
sage: # needs sage.rings.finite_rings
1622+
sage: # needs sage.libs.singular
16241623
sage: R.<X,Y> = GF(5)[]
16251624
sage: S.<x,y> = R.quo([X^5, Y^5])
16261625
sage: Dx = S.derivation(x)
@@ -1637,7 +1636,7 @@ def _sub_(self, other):
16371636
16381637
EXAMPLES::
16391638
1640-
sage: # needs sage.rings.finite_rings
1639+
sage: # needs sage.libs.singular
16411640
sage: R.<X,Y> = GF(5)[]
16421641
sage: S.<x,y> = R.quo([X^5, Y^5])
16431642
sage: Dx = S.derivation(x)
@@ -1654,7 +1653,7 @@ def _neg_(self):
16541653
16551654
EXAMPLES::
16561655
1657-
sage: # needs sage.rings.finite_rings
1656+
sage: # needs sage.libs.singular
16581657
sage: R.<X,Y> = GF(5)[]
16591658
sage: S.<x,y> = R.quo([X^5, Y^5])
16601659
sage: Dx = S.derivation(x)
@@ -1670,7 +1669,7 @@ def _lmul_(self, factor):
16701669
16711670
EXAMPLES::
16721671
1673-
sage: # needs sage.rings.finite_rings
1672+
sage: # needs sage.libs.singular
16741673
sage: R.<X,Y> = GF(5)[]
16751674
sage: S.<x,y> = R.quo([X^5, Y^5])
16761675
sage: Dx = S.derivation(x)
@@ -1688,7 +1687,7 @@ def _rmul_(self, factor):
16881687
16891688
EXAMPLES::
16901689
1691-
sage: # needs sage.rings.finite_rings
1690+
sage: # needs sage.libs.singular
16921691
sage: R.<X,Y> = GF(5)[]
16931692
sage: S.<x,y> = R.quo([X^5, Y^5])
16941693
sage: Dx = S.derivation(x)
@@ -1707,21 +1706,19 @@ def list(self):
17071706
17081707
EXAMPLES::
17091708
1710-
sage: # needs sage.rings.finite_rings
1709+
sage: # needs sage.libs.singular
17111710
sage: R.<X,Y> = GF(5)[]
17121711
sage: S.<x,y> = R.quo([X^5, Y^5])
17131712
sage: M = S.derivation_module()
17141713
sage: M.basis()
17151714
Family (d/dx, d/dy)
1716-
1717-
sage: S.derivation(x).list() # needs sage.rings.finite_rings
1715+
sage: S.derivation(x).list()
17181716
[1, 0]
1719-
sage: S.derivation(y).list() # needs sage.rings.finite_rings
1717+
sage: S.derivation(y).list()
17201718
[0, 1]
1721-
1722-
sage: f = x*S.derivation(x) + y*S.derivation(y); f # needs sage.rings.finite_rings
1719+
sage: f = x*S.derivation(x) + y*S.derivation(y); f
17231720
x*d/dx + y*d/dy
1724-
sage: f.list() # needs sage.rings.finite_rings
1721+
sage: f.list()
17251722
[x, y]
17261723
17271724
"""
@@ -2000,7 +1997,7 @@ def _call_(self, x):
20001997
20011998
EXAMPLES::
20021999
2003-
sage: # needs sage.rings.finite_rings
2000+
sage: # needs sage.libs.singular
20042001
sage: R.<X,Y> = GF(5)[]
20052002
sage: S.<x,y> = R.quo([X^5, Y^5])
20062003
sage: f = x^3*S.derivation(); f

src/sage/rings/factorint.pyx

+11-4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ cpdef aurifeuillian(n, m, F=None, bint check=True) noexcept:
5050
EXAMPLES::
5151
5252
sage: from sage.rings.factorint import aurifeuillian
53+
54+
sage: # needs sage.libs.pari sage.rings.real_interval_field
5355
sage: aurifeuillian(2, 2)
5456
[5, 13]
5557
sage: aurifeuillian(2, 2^5)
@@ -58,6 +60,8 @@ cpdef aurifeuillian(n, m, F=None, bint check=True) noexcept:
5860
[1471, 2851]
5961
sage: aurifeuillian(15, 1)
6062
[19231, 142111]
63+
64+
sage: # needs sage.libs.pari
6165
sage: aurifeuillian(12, 3)
6266
Traceback (most recent call last):
6367
...
@@ -76,15 +80,17 @@ cpdef aurifeuillian(n, m, F=None, bint check=True) noexcept:
7680
There is no need to set `F`. It's only for increasing speed
7781
of :meth:`factor_aurifeuillian()`.
7882
"""
79-
from sage.arith.misc import euler_phi
80-
from sage.rings.real_mpfi import RealIntervalField
8183
if check:
8284
if not n.is_squarefree():
8385
raise ValueError("n has to be square-free")
8486
if n < 2:
8587
raise ValueError("n has to be greater than 1")
8688
if m < 1:
8789
raise ValueError("m has to be positive")
90+
91+
from sage.arith.misc import euler_phi
92+
from sage.rings.real_mpfi import RealIntervalField
93+
8894
x = m**2*n
8995
cdef Py_ssize_t y = euler_phi(2*n)//2
9096
if F is None:
@@ -129,7 +135,7 @@ cpdef factor_aurifeuillian(n, check=True) noexcept:
129135
130136
EXAMPLES::
131137
132-
sage: # needs sage.libs.pari
138+
sage: # needs sage.libs.pari sage.rings.real_interval_field
133139
sage: from sage.rings.factorint import factor_aurifeuillian as fa
134140
sage: fa(2^6 + 1)
135141
[5, 13]
@@ -148,7 +154,8 @@ cpdef factor_aurifeuillian(n, check=True) noexcept:
148154
149155
TESTS::
150156
151-
sage: for n in [2,3,5,6,30,31,33]: # needs sage.libs.pari
157+
sage: # needs sage.libs.pari sage.rings.real_interval_field
158+
sage: for n in [2,3,5,6,30,31,33]:
152159
....: for m in [8,96,109201283]:
153160
....: s = -1 if n % 4 == 1 else 1
154161
....: y = (m^2*n)^n + s

0 commit comments

Comments
 (0)