passagemath-flint 10.5.43__cp312-cp312-musllinux_1_2_aarch64.whl → 10.6.1rc1__cp312-cp312-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {passagemath_flint-10.5.43.dist-info → passagemath_flint-10.6.1rc1.dist-info}/METADATA +5 -6
- {passagemath_flint-10.5.43.dist-info → passagemath_flint-10.6.1rc1.dist-info}/RECORD +100 -100
- passagemath_flint.libs/{libflint-7dd7ad94.so.19.0.0 → libflint-4ce13791.so.20.0.1} +0 -0
- sage/combinat/posets/hasse_cython_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/data_structures/bounded_integer_sequences.cpython-312-aarch64-linux-musl.so +0 -0
- sage/data_structures/bounded_integer_sequences.pyx +22 -20
- sage/graphs/chrompoly.cpython-312-aarch64-linux-musl.so +0 -0
- sage/graphs/chrompoly.pyx +4 -3
- sage/graphs/matchpoly.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/arb/arith.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/arith.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/arith_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/flint.pxd +2 -2
- sage/libs/flint/flint_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/flint_wrap.h +4 -0
- sage/libs/flint/fmpq_poly_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/fmpz_factor_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/fmpz_poly.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/fmpz_poly_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/nmod_poly_linkage.pxi +5 -4
- sage/libs/flint/qsieve.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/qsieve_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/types.pxd +2 -2
- sage/libs/flint/ulong_extras.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/flint/ulong_extras_sage.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/change_ring.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_complex_ball_dense.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_cyclo_dense.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_cyclo_dense.pyx +3 -3
- sage/matrix/matrix_integer_dense.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_integer_dense.pyx +50 -33
- sage/matrix/matrix_integer_sparse.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_integer_sparse.pyx +1 -1
- sage/matrix/matrix_rational_dense.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_rational_dense.pyx +64 -28
- sage/matrix/matrix_rational_sparse.cpython-312-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_rational_sparse.pyx +3 -3
- sage/matrix/misc_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/modular/modform/eis_series_cython.cpython-312-aarch64-linux-musl.so +0 -0
- sage/modular/modsym/apply.cpython-312-aarch64-linux-musl.so +0 -0
- sage/modular/modsym/heilbronn.cpython-312-aarch64-linux-musl.so +0 -0
- sage/modular/pollack_stevens/dist.cpython-312-aarch64-linux-musl.so +0 -0
- sage/modular/pollack_stevens/dist.pyx +2 -2
- sage/quivers/algebra.py +2 -1
- sage/quivers/algebra_elements.cpython-312-aarch64-linux-musl.so +0 -0
- sage/quivers/algebra_elements.pyx +5 -5
- sage/quivers/ar_quiver.py +21 -21
- sage/quivers/homspace.py +2 -1
- sage/quivers/morphism.py +31 -29
- sage/quivers/path_semigroup.py +14 -11
- sage/quivers/paths.cpython-312-aarch64-linux-musl.so +0 -0
- sage/quivers/paths.pyx +2 -2
- sage/quivers/representation.py +22 -24
- sage/rings/complex_arb.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/complex_arb.pyx +37 -36
- sage/rings/complex_interval.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/convert/mpfi.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/factorint_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_FpT.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_FpT.pyx +29 -0
- sage/rings/number_field/S_unit_solver.py +1 -1
- sage/rings/number_field/galois_group.py +1 -1
- sage/rings/number_field/morphism.py +3 -4
- sage/rings/number_field/number_field.py +97 -75
- sage/rings/number_field/number_field_element.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element.pyx +72 -0
- sage/rings/number_field/number_field_element_quadratic.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element_quadratic.pyx +35 -17
- sage/rings/number_field/number_field_morphisms.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_morphisms.pyx +2 -2
- sage/rings/number_field/number_field_rel.py +1 -1
- sage/rings/number_field/order.py +44 -47
- sage/rings/number_field/order_ideal.py +2 -5
- sage/rings/polynomial/evaluation_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/hilbert.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/hilbert.pyx +3 -6
- sage/rings/polynomial/polynomial_complex_arb.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_integer_dense_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_integer_dense_flint.pyx +3 -5
- sage/rings/polynomial/polynomial_number_field.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_rational_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_rational_flint.pxd +3 -3
- sage/rings/polynomial/polynomial_rational_flint.pyx +24 -11
- sage/rings/polynomial/polynomial_zmod_flint.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_zmod_flint.pyx +3 -4
- sage/rings/polynomial/real_roots.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/real_roots.pyx +1 -1
- sage/rings/polynomial/refine_root.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/weil/weil_polynomials.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/weil/weil_polynomials.pyx +1 -1
- sage/rings/qqbar.py +1 -1
- sage/rings/real_arb.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/real_arb.pyx +21 -10
- sage/rings/real_interval_absolute.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/real_mpfi.cpython-312-aarch64-linux-musl.so +0 -0
- sage/rings/real_mpfi.pyx +14 -11
- sage/schemes/elliptic_curves/descent_two_isogeny.cpython-312-aarch64-linux-musl.so +0 -0
- sage/schemes/elliptic_curves/descent_two_isogeny.pyx +11 -0
- {passagemath_flint-10.5.43.dist-info → passagemath_flint-10.6.1rc1.dist-info}/WHEEL +0 -0
- {passagemath_flint-10.5.43.dist-info → passagemath_flint-10.6.1rc1.dist-info}/top_level.txt +0 -0
@@ -573,6 +573,35 @@ cdef class FpTElement(FieldElement):
|
|
573
573
|
normalize(x._numer, x._denom, self.p)
|
574
574
|
return x
|
575
575
|
|
576
|
+
def _im_gens_(self, codomain, im_gens, base_map=None):
|
577
|
+
r"""
|
578
|
+
Return the image of this element in ``codomain`` under the
|
579
|
+
map that sends the image of the generator of the parent to
|
580
|
+
the element in ``im_gens``.
|
581
|
+
|
582
|
+
INPUT:
|
583
|
+
|
584
|
+
- ``codomain`` -- a ring; where the image is computed
|
585
|
+
|
586
|
+
- ``im_gens`` -- a list containing the image of the
|
587
|
+
generator of the parent as unique element
|
588
|
+
|
589
|
+
- ``base_map`` -- a morphism (default: ``None``);
|
590
|
+
the action on the underlying base ring
|
591
|
+
|
592
|
+
EXAMPLES::
|
593
|
+
|
594
|
+
sage: A.<T> = GF(5)[]
|
595
|
+
sage: K.<T> = Frac(A)
|
596
|
+
sage: f = K.hom([T^2])
|
597
|
+
sage: f(1/T)
|
598
|
+
1/T^2
|
599
|
+
"""
|
600
|
+
nden = self.denom()._im_gens_(codomain, im_gens, base_map=base_map)
|
601
|
+
invden = nden.inverse_of_unit()
|
602
|
+
nnum = self.numer()._im_gens_(codomain, im_gens, base_map=base_map)
|
603
|
+
return nnum * invden
|
604
|
+
|
576
605
|
cpdef FpTElement next(self):
|
577
606
|
"""
|
578
607
|
Iterate through all polynomials, returning the "next" polynomial after this one.
|
@@ -1420,7 +1420,7 @@ def defining_polynomial_for_Kp(prime, prec=106):
|
|
1420
1420
|
L = [g.change_ring(ZZ) for g, _ in factors]
|
1421
1421
|
A = [g for g in L if (g(theta)).valuation(prime) >= e*N/2]
|
1422
1422
|
|
1423
|
-
# We narrow down the list
|
1423
|
+
# We narrow down the list until only one value remains
|
1424
1424
|
|
1425
1425
|
if len(A) == 1:
|
1426
1426
|
return A[0].change_ring(Integers(p**prec)).change_ring(ZZ)
|
@@ -995,7 +995,7 @@ class GaloisGroup_v2(GaloisGroup_perm):
|
|
995
995
|
sage: x = polygen(ZZ, 'x')
|
996
996
|
sage: K.<b> = NumberField(x^4 - 2*x^2 + 2, 'a').galois_closure()
|
997
997
|
sage: G = K.galois_group()
|
998
|
-
sage: sorted([G.artin_symbol(P) for P in K.primes_above(7)])
|
998
|
+
sage: sorted([G.artin_symbol(P) for P in K.primes_above(7)]) # random (see remark in primes_above)
|
999
999
|
[(1,4)(2,3)(5,8)(6,7),
|
1000
1000
|
(1,4)(2,3)(5,8)(6,7),
|
1001
1001
|
(1,5)(2,6)(3,7)(4,8),
|
@@ -7,18 +7,17 @@ This module provides classes to represent ring homomorphisms between number
|
|
7
7
|
fields (i.e. field embeddings).
|
8
8
|
"""
|
9
9
|
|
10
|
-
|
10
|
+
# ***************************************************************************
|
11
11
|
# Copyright (C) 2007 William Stein <wstein@gmail.com>
|
12
12
|
#
|
13
13
|
# This program is free software: you can redistribute it and/or modify
|
14
14
|
# it under the terms of the GNU General Public License as published by
|
15
15
|
# the Free Software Foundation, either version 2 of the License, or
|
16
16
|
# (at your option) any later version.
|
17
|
-
#
|
18
|
-
|
17
|
+
# https://www.gnu.org/licenses/
|
18
|
+
# ***************************************************************************
|
19
19
|
|
20
20
|
from sage.misc.cachefunc import cached_method
|
21
|
-
from sage.misc.lazy_import import lazy_import
|
22
21
|
|
23
22
|
from sage.rings.morphism import RingHomomorphism_im_gens, RingHomomorphism
|
24
23
|
from sage.structure.sequence import Sequence
|
@@ -86,8 +86,6 @@ import sage.rings.abc
|
|
86
86
|
import sage.rings.complex_mpfr
|
87
87
|
from sage.rings.polynomial.polynomial_element import Polynomial
|
88
88
|
import sage.rings.real_mpfr
|
89
|
-
import sage.rings.real_mpfi
|
90
|
-
import sage.rings.complex_double
|
91
89
|
import sage.rings.real_double
|
92
90
|
import sage.rings.real_lazy
|
93
91
|
|
@@ -114,6 +112,7 @@ from sage.structure.proof.proof import get_flag
|
|
114
112
|
from . import maps
|
115
113
|
from . import structure
|
116
114
|
from . import number_field_morphisms
|
115
|
+
from . import number_field_base
|
117
116
|
|
118
117
|
from sage.categories.homset import Hom
|
119
118
|
from sage.categories.sets_cat import Sets
|
@@ -124,6 +123,33 @@ from sage.rings.real_mpfr import RR
|
|
124
123
|
from sage.interfaces.abc import GapElement
|
125
124
|
from sage.rings.number_field.morphism import RelativeNumberFieldHomomorphism_from_abs
|
126
125
|
|
126
|
+
from sage.misc.latex import latex
|
127
|
+
|
128
|
+
import sage.rings.infinity as infinity
|
129
|
+
from sage.rings.rational import Rational
|
130
|
+
from sage.rings.integer import Integer
|
131
|
+
import sage.rings.polynomial.polynomial_element as polynomial_element
|
132
|
+
import sage.groups.abelian_gps.abelian_group
|
133
|
+
import sage.rings.complex_interval_field
|
134
|
+
|
135
|
+
from sage.structure.factory import UniqueFactory
|
136
|
+
from . import number_field_element
|
137
|
+
from . import number_field_element_quadratic
|
138
|
+
from .number_field_ideal import NumberFieldIdeal, NumberFieldFractionalIdeal
|
139
|
+
|
140
|
+
try:
|
141
|
+
from sage.libs.pari import pari
|
142
|
+
from cypari2.gen import Gen as pari_gen
|
143
|
+
except ImportError:
|
144
|
+
pari_gen = ()
|
145
|
+
|
146
|
+
from sage.rings.rational_field import QQ
|
147
|
+
from sage.rings.integer_ring import ZZ
|
148
|
+
from sage.rings.cif import CIF
|
149
|
+
from sage.rings.real_double import RDF
|
150
|
+
from sage.rings.real_lazy import RLF, CLF
|
151
|
+
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
|
152
|
+
|
127
153
|
lazy_import('sage.libs.gap.element', 'GapElement', as_='LibGapElement')
|
128
154
|
lazy_import('sage.misc.sage_eval', 'sage_eval')
|
129
155
|
lazy_import('sage.rings.number_field.unit_group', 'UnitGroup')
|
@@ -134,18 +160,14 @@ lazy_import('sage.rings.universal_cyclotomic_field', 'UniversalCyclotomicFieldEl
|
|
134
160
|
_NumberFields = NumberFields()
|
135
161
|
|
136
162
|
|
137
|
-
def is_NumberFieldHomsetCodomain(codomain):
|
163
|
+
def is_NumberFieldHomsetCodomain(codomain, category=None):
|
138
164
|
"""
|
139
|
-
Return whether ``codomain`` is a valid codomain for a
|
140
|
-
|
141
|
-
|
142
|
-
This is used by NumberField._Hom_ to determine
|
143
|
-
whether the created homsets should be a
|
144
|
-
:class:`sage.rings.number_field.homset.NumberFieldHomset`.
|
165
|
+
Return whether ``codomain`` is a valid codomain for a
|
166
|
+
:class:`NumberFieldHomset` in ``category``.
|
145
167
|
|
146
168
|
EXAMPLES:
|
147
169
|
|
148
|
-
This currently accepts any
|
170
|
+
This currently accepts any ring (CC, RR, ...)::
|
149
171
|
|
150
172
|
sage: from sage.rings.number_field.number_field import is_NumberFieldHomsetCodomain
|
151
173
|
sage: is_NumberFieldHomsetCodomain(QQ)
|
@@ -154,24 +176,31 @@ def is_NumberFieldHomsetCodomain(codomain):
|
|
154
176
|
sage: is_NumberFieldHomsetCodomain(NumberField(x^2 + 1, 'x'))
|
155
177
|
True
|
156
178
|
sage: is_NumberFieldHomsetCodomain(ZZ)
|
157
|
-
|
179
|
+
True
|
158
180
|
sage: is_NumberFieldHomsetCodomain(3)
|
159
181
|
False
|
160
182
|
sage: is_NumberFieldHomsetCodomain(MatrixSpace(QQ, 2))
|
161
|
-
|
183
|
+
True
|
162
184
|
sage: is_NumberFieldHomsetCodomain(InfinityRing)
|
163
|
-
|
164
|
-
|
165
|
-
Question: should, for example, QQ-algebras be accepted as well?
|
185
|
+
True
|
166
186
|
|
167
|
-
|
168
|
-
|
187
|
+
Gap objects are not (yet) in :class:`Fields`, and therefore not accepted as
|
188
|
+
number field homset codomains::
|
169
189
|
|
170
190
|
sage: is_NumberFieldHomsetCodomain(gap.Rationals) # needs sage.libs.gap
|
171
191
|
False
|
172
192
|
"""
|
173
|
-
from sage.categories.
|
174
|
-
|
193
|
+
from sage.categories.rings import Rings
|
194
|
+
|
195
|
+
if category is None:
|
196
|
+
category = codomain.category()
|
197
|
+
|
198
|
+
if not category.is_subcategory(Rings()):
|
199
|
+
return False
|
200
|
+
|
201
|
+
assert codomain in category
|
202
|
+
|
203
|
+
return True
|
175
204
|
|
176
205
|
|
177
206
|
def proof_flag(t):
|
@@ -196,36 +225,6 @@ def proof_flag(t):
|
|
196
225
|
return get_flag(t, "number_field")
|
197
226
|
|
198
227
|
|
199
|
-
from sage.misc.latex import latex
|
200
|
-
|
201
|
-
import sage.rings.infinity as infinity
|
202
|
-
from sage.rings.rational import Rational
|
203
|
-
from sage.rings.integer import Integer
|
204
|
-
import sage.rings.polynomial.polynomial_element as polynomial_element
|
205
|
-
import sage.groups.abelian_gps.abelian_group
|
206
|
-
import sage.rings.complex_interval_field
|
207
|
-
|
208
|
-
from sage.structure.factory import UniqueFactory
|
209
|
-
from . import number_field_element
|
210
|
-
from . import number_field_element_quadratic
|
211
|
-
from .number_field_ideal import NumberFieldIdeal, NumberFieldFractionalIdeal
|
212
|
-
|
213
|
-
from sage.rings.rational_field import QQ
|
214
|
-
from sage.rings.integer_ring import ZZ
|
215
|
-
from sage.rings.real_mpfi import RIF
|
216
|
-
from sage.rings.cif import CIF
|
217
|
-
from sage.rings.real_double import RDF
|
218
|
-
from sage.rings.complex_double import CDF
|
219
|
-
from sage.rings.real_lazy import RLF, CLF
|
220
|
-
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
|
221
|
-
|
222
|
-
try:
|
223
|
-
from sage.libs.pari import pari
|
224
|
-
from cypari2.gen import Gen as pari_gen
|
225
|
-
except ImportError:
|
226
|
-
pari_gen = ()
|
227
|
-
|
228
|
-
|
229
228
|
def NumberField(polynomial, name=None, check=True, names=None, embedding=None,
|
230
229
|
latex_name=None, assume_disc_small=False, maximize_at_primes=None, structure=None,
|
231
230
|
*, latex_names=None, **kwds):
|
@@ -1200,9 +1199,6 @@ class CyclotomicFieldFactory(UniqueFactory):
|
|
1200
1199
|
CyclotomicField = CyclotomicFieldFactory("sage.rings.number_field.number_field.CyclotomicField")
|
1201
1200
|
|
1202
1201
|
|
1203
|
-
from . import number_field_base
|
1204
|
-
|
1205
|
-
|
1206
1202
|
is_NumberField = number_field_base.is_NumberField
|
1207
1203
|
|
1208
1204
|
|
@@ -1990,10 +1986,9 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
1990
1986
|
sage: loads(dumps(H)) is H
|
1991
1987
|
True
|
1992
1988
|
"""
|
1993
|
-
if not is_NumberFieldHomsetCodomain(codomain):
|
1994
|
-
|
1995
|
-
|
1996
|
-
raise TypeError(LazyFormat("%s is not suitable as codomain for homomorphisms from %s") % (codomain, self))
|
1989
|
+
if not is_NumberFieldHomsetCodomain(codomain, category):
|
1990
|
+
raise TypeError
|
1991
|
+
|
1997
1992
|
from sage.rings.number_field.homset import NumberFieldHomset
|
1998
1993
|
return NumberFieldHomset(self, codomain, category)
|
1999
1994
|
|
@@ -2053,6 +2048,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
2053
2048
|
if p == infinity.infinity:
|
2054
2049
|
gen_image = self.gen_embedding()
|
2055
2050
|
if gen_image is not None:
|
2051
|
+
from sage.rings.complex_double import CDF
|
2052
|
+
|
2056
2053
|
if gen_image in RDF:
|
2057
2054
|
return QQ.completion(p, prec, extras)
|
2058
2055
|
elif gen_image in CDF:
|
@@ -2609,11 +2606,11 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
2609
2606
|
f = x**2 + x
|
2610
2607
|
while w < u and not w % 2:
|
2611
2608
|
s = F.lift(q((a - 1) / pi**w).sqrt())
|
2612
|
-
a = a / (1 + s*(pi**(w/2)))**2
|
2609
|
+
a = a / (1 + s * (pi**(w / 2)))**2
|
2613
2610
|
w = (a - 1).valuation(p)
|
2614
2611
|
if w < u and w % 2:
|
2615
2612
|
return v + w
|
2616
|
-
if w == u and (f + F((a-1) / 4)).is_irreducible():
|
2613
|
+
if w == u and (f + F((a - 1) / 4)).is_irreducible():
|
2617
2614
|
return v + w
|
2618
2615
|
return Infinity
|
2619
2616
|
|
@@ -3424,7 +3421,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
3424
3421
|
H.append(chi)
|
3425
3422
|
return H
|
3426
3423
|
|
3427
|
-
def _repr_(self):
|
3424
|
+
def _repr_(self) -> str:
|
3428
3425
|
"""
|
3429
3426
|
Return string representation of this number field.
|
3430
3427
|
|
@@ -3444,7 +3441,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
3444
3441
|
result += " with {} = {}".format(self.variable_name(), gen)
|
3445
3442
|
return result
|
3446
3443
|
|
3447
|
-
def _latex_(self):
|
3444
|
+
def _latex_(self) -> str:
|
3448
3445
|
r"""
|
3449
3446
|
Return latex representation of this number field. This is viewed as
|
3450
3447
|
a polynomial quotient ring over a field.
|
@@ -3934,6 +3931,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
3934
3931
|
Fractional ideal (3)]
|
3935
3932
|
sage: K.primes_of_bounded_norm(1)
|
3936
3933
|
[]
|
3934
|
+
sage: K.primes_of_bounded_norm(1.1)
|
3935
|
+
[]
|
3937
3936
|
sage: x = polygen(QQ, 'x')
|
3938
3937
|
sage: K.<a> = NumberField(x^3 - 2)
|
3939
3938
|
sage: P = K.primes_of_bounded_norm(30)
|
@@ -3953,7 +3952,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
3953
3952
|
B = ZZ(B)
|
3954
3953
|
except (TypeError, AttributeError):
|
3955
3954
|
try:
|
3956
|
-
B = ZZ(B.
|
3955
|
+
B = ZZ(B.floor())
|
3957
3956
|
except (TypeError, AttributeError):
|
3958
3957
|
raise TypeError("%s is not valid bound on prime ideals" % B)
|
3959
3958
|
if B < 2:
|
@@ -4616,6 +4615,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
4616
4615
|
``proof.number_field(False)``. It can easily take 1000s of times
|
4617
4616
|
longer to do computations with ``proof=True`` (the default).
|
4618
4617
|
"""
|
4618
|
+
from .class_group import ClassGroup
|
4619
|
+
|
4619
4620
|
proof = proof_flag(proof)
|
4620
4621
|
try:
|
4621
4622
|
return self.__class_group[proof, names]
|
@@ -4703,6 +4704,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
4703
4704
|
Class group of order 4 with structure C4 of Number Field in a
|
4704
4705
|
with defining polynomial x^2 + 14 with a = 3.741657386773942?*I
|
4705
4706
|
"""
|
4707
|
+
from .class_group import SClassGroup
|
4708
|
+
|
4706
4709
|
proof = proof_flag(proof)
|
4707
4710
|
if all(P.is_principal() for P in S):
|
4708
4711
|
C = self.class_group(proof=proof)
|
@@ -6531,10 +6534,10 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
6531
6534
|
# faster than computing all the conjugates, etc ...
|
6532
6535
|
|
6533
6536
|
# flag to disable FLATTER, which is much more unstable than fplll
|
6534
|
-
flag = 1 if pari.version() >= (2,17) else 0
|
6537
|
+
flag = 1 if pari.version() >= (2, 17) else 0
|
6535
6538
|
if self.is_totally_real():
|
6536
6539
|
from sage.matrix.constructor import matrix
|
6537
|
-
M = matrix(ZZ, d, d, [[(x*y).trace() for x in ZK] for y in ZK])
|
6540
|
+
M = matrix(ZZ, d, d, [[(x * y).trace() for x in ZK] for y in ZK])
|
6538
6541
|
T = pari(M).qflllgram(flag=flag)
|
6539
6542
|
else:
|
6540
6543
|
M = self.minkowski_embedding(ZK, prec=prec)
|
@@ -6709,10 +6712,12 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
6709
6712
|
sage: QuadraticField(3, 'a').narrow_class_group()
|
6710
6713
|
Multiplicative Abelian group isomorphic to C2
|
6711
6714
|
"""
|
6715
|
+
from sage.groups.abelian_gps.abelian_group import AbelianGroup
|
6716
|
+
|
6712
6717
|
proof = proof_flag(proof)
|
6713
6718
|
k = self.pari_bnf(proof)
|
6714
6719
|
s = k.bnfnarrow().sage()
|
6715
|
-
return
|
6720
|
+
return AbelianGroup(s[1])
|
6716
6721
|
|
6717
6722
|
def ngens(self):
|
6718
6723
|
"""
|
@@ -6778,6 +6783,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
6778
6783
|
return (self.__polynomial_ntl, self.__denominator_ntl)
|
6779
6784
|
except AttributeError:
|
6780
6785
|
import sage.libs.ntl.all as ntl
|
6786
|
+
|
6781
6787
|
self.__denominator_ntl = ntl.ZZ()
|
6782
6788
|
den = self.polynomial().denominator()
|
6783
6789
|
self.__denominator_ntl.set_from_sage_int(ZZ(den))
|
@@ -7223,6 +7229,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
7223
7229
|
-a^15 - a^14 - 2*a^11 - a^10 + a^9 - a^8 - 2*a^7 + a^5 - 2*a^3 + a^2 + 3*a - 1,
|
7224
7230
|
-3*a^16 - 3*a^15 - 3*a^14 - 3*a^13 - 3*a^12 - 2*a^11 - 2*a^10 - 2*a^9 - a^8 + a^7 + 2*a^6 + 3*a^5 + 3*a^4 + 4*a^3 + 6*a^2 + 8*a + 8]
|
7225
7231
|
"""
|
7232
|
+
from sage.rings.number_field.unit_group import UnitGroup
|
7233
|
+
|
7226
7234
|
proof = proof_flag(proof)
|
7227
7235
|
|
7228
7236
|
try:
|
@@ -7339,6 +7347,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
|
|
7339
7347
|
sage: U.log(u)
|
7340
7348
|
(1, 1, 4, 1, 5)
|
7341
7349
|
"""
|
7350
|
+
from sage.rings.number_field.unit_group import UnitGroup
|
7351
|
+
|
7342
7352
|
proof = proof_flag(proof)
|
7343
7353
|
|
7344
7354
|
# process the parameter S:
|
@@ -9651,6 +9661,8 @@ class NumberField_absolute(NumberField_generic):
|
|
9651
9661
|
Defn: alpha |--> 0.96 + 1.7*I]
|
9652
9662
|
"""
|
9653
9663
|
if prec is None:
|
9664
|
+
from sage.rings.real_mpfi import RIF
|
9665
|
+
|
9654
9666
|
R = RIF
|
9655
9667
|
C = CIF
|
9656
9668
|
|
@@ -10476,7 +10488,7 @@ class NumberField_absolute(NumberField_generic):
|
|
10476
10488
|
# symbol is negative for all primes in S and positive
|
10477
10489
|
# at all primes in S'
|
10478
10490
|
# For technical reasons, a Hilbert symbol of -1 is
|
10479
|
-
#
|
10491
|
+
# represented as 1 and a Hilbert symbol of 1
|
10480
10492
|
# is represented as 0
|
10481
10493
|
V = VectorSpace(GF(2), len(SL))
|
10482
10494
|
v = V([1]*len(S) + [0]*len(L))
|
@@ -10871,8 +10883,9 @@ class NumberField_cyclotomic(NumberField_absolute, sage.rings.abc.NumberField_cy
|
|
10871
10883
|
# As a consequence, a result of _an_element_() with the wrong class
|
10872
10884
|
# is cached during the call to has_coerce_map_from. We reset the
|
10873
10885
|
# cache afterwards.
|
10886
|
+
from sage.rings.complex_double import CDF
|
10887
|
+
|
10874
10888
|
self._standard_embedding = not CDF.has_coerce_map_from(self) or CDF(self.gen()).imag() > 0
|
10875
|
-
self._cache_an_element = None
|
10876
10889
|
|
10877
10890
|
if n == 4:
|
10878
10891
|
self._element_class = number_field_element_quadratic.NumberFieldElement_gaussian
|
@@ -11028,7 +11041,7 @@ class NumberField_cyclotomic(NumberField_absolute, sage.rings.abc.NumberField_cy
|
|
11028
11041
|
from sage.libs.gap.libgap import libgap
|
11029
11042
|
return libgap.CyclotomicField(self.__n)
|
11030
11043
|
|
11031
|
-
def _repr_(self):
|
11044
|
+
def _repr_(self) -> str:
|
11032
11045
|
r"""
|
11033
11046
|
Return string representation of this cyclotomic field.
|
11034
11047
|
|
@@ -11060,7 +11073,7 @@ class NumberField_cyclotomic(NumberField_absolute, sage.rings.abc.NumberField_cy
|
|
11060
11073
|
"""
|
11061
11074
|
return self.__n
|
11062
11075
|
|
11063
|
-
def _latex_(self):
|
11076
|
+
def _latex_(self) -> str:
|
11064
11077
|
r"""
|
11065
11078
|
Return the latex representation of this cyclotomic field.
|
11066
11079
|
|
@@ -11301,6 +11314,8 @@ class NumberField_cyclotomic(NumberField_absolute, sage.rings.abc.NumberField_cy
|
|
11301
11314
|
sage: K5._log_gen(zeta15**3)
|
11302
11315
|
4
|
11303
11316
|
"""
|
11317
|
+
from sage.rings.complex_double import CDF
|
11318
|
+
|
11304
11319
|
X = x.parent()
|
11305
11320
|
gen = self.gen()
|
11306
11321
|
|
@@ -11502,13 +11517,11 @@ class NumberField_cyclotomic(NumberField_absolute, sage.rings.abc.NumberField_cy
|
|
11502
11517
|
zeta = self.gen()
|
11503
11518
|
return sum(QQ(c) * zeta**i for i, c in enumerate(coeffs))
|
11504
11519
|
|
11505
|
-
def _Hom_(self, codomain,
|
11520
|
+
def _Hom_(self, codomain, category=None):
|
11506
11521
|
"""
|
11507
11522
|
Return homset of homomorphisms from the cyclotomic field ``self`` to
|
11508
11523
|
the number field codomain.
|
11509
11524
|
|
11510
|
-
The ``cat`` option is currently ignored.
|
11511
|
-
|
11512
11525
|
EXAMPLES:
|
11513
11526
|
|
11514
11527
|
This function is implicitly called by the Hom method or
|
@@ -11525,13 +11538,20 @@ class NumberField_cyclotomic(NumberField_absolute, sage.rings.abc.NumberField_cy
|
|
11525
11538
|
to Number Field in a with defining polynomial x^2 + 3
|
11526
11539
|
sage: End(CyclotomicField(21))
|
11527
11540
|
Automorphism group of Cyclotomic Field of order 21 and degree 12
|
11541
|
+
|
11542
|
+
::
|
11543
|
+
|
11544
|
+
sage: K = CyclotomicField(3)
|
11545
|
+
sage: Hom(K, ZZ).category()
|
11546
|
+
Category of homsets of euclidean domains and noetherian rings
|
11547
|
+
|
11528
11548
|
"""
|
11529
|
-
if is_NumberFieldHomsetCodomain(codomain):
|
11530
|
-
from sage.rings.number_field.homset import CyclotomicFieldHomset
|
11531
|
-
return CyclotomicFieldHomset(self, codomain)
|
11532
|
-
else:
|
11549
|
+
if not is_NumberFieldHomsetCodomain(codomain, category):
|
11533
11550
|
raise TypeError
|
11534
11551
|
|
11552
|
+
from sage.rings.number_field.homset import CyclotomicFieldHomset
|
11553
|
+
return CyclotomicFieldHomset(self, codomain, category)
|
11554
|
+
|
11535
11555
|
def is_galois(self):
|
11536
11556
|
"""
|
11537
11557
|
Return ``True`` since all cyclotomic fields are automatically Galois.
|
@@ -12101,6 +12121,8 @@ class NumberField_quadratic(NumberField_absolute, sage.rings.abc.NumberField_qua
|
|
12101
12121
|
|
12102
12122
|
self._NumberField_generic__gen = self._element_class(self, parts)
|
12103
12123
|
|
12124
|
+
from sage.rings.complex_double import CDF
|
12125
|
+
|
12104
12126
|
# we must set the flag _standard_embedding *before* any element creation
|
12105
12127
|
# Note that in the following code, no element is built.
|
12106
12128
|
if self.coerce_embedding() is not None and CDF.has_coerce_map_from(self):
|
Binary file
|
@@ -889,6 +889,43 @@ cdef class NumberFieldElement(NumberFieldElement_base):
|
|
889
889
|
|
890
890
|
EXAMPLES::
|
891
891
|
|
892
|
+
sage: x = polygen(ZZ, 'x')
|
893
|
+
sage: K.<a> = NumberField(x^3 - 2)
|
894
|
+
sage: a._random_element() # random
|
895
|
+
-1/2*a^2 - 4
|
896
|
+
sage: K.<a> = NumberField(x^2 - 5)
|
897
|
+
sage: a._random_element() # random
|
898
|
+
-1/48*a - 1/2
|
899
|
+
|
900
|
+
With denominator bound one, we always get integral elements::
|
901
|
+
|
902
|
+
sage: K = QuadraticField(2)
|
903
|
+
sage: uu = [K.random_element(den_bound=1) for _ in range(5)]
|
904
|
+
sage: uu # random
|
905
|
+
[0, a + 2, -12*a - 2, -a + 1, -a - 2]
|
906
|
+
sage: all(u.is_integral() for u in uu)
|
907
|
+
True
|
908
|
+
|
909
|
+
Without this constraint, we do not always get them::
|
910
|
+
|
911
|
+
sage: K = QuadraticField(2)
|
912
|
+
sage: uu = [K.random_element() for _ in range(100)]
|
913
|
+
sage: all(u.is_integral() for u in uu)
|
914
|
+
False
|
915
|
+
|
916
|
+
Random integral elements can also be picked using the random_element
|
917
|
+
method of the number field's "ring of integers" or "maximal order" ::
|
918
|
+
|
919
|
+
sage: K = QuadraticField(2)
|
920
|
+
sage: O = K.maximal_order()
|
921
|
+
sage: O.random_element() # random
|
922
|
+
5*a - 6
|
923
|
+
sage: O = K.ring_of_integers()
|
924
|
+
sage: O.random_element() # random
|
925
|
+
-4*a + 1
|
926
|
+
|
927
|
+
TESTS::
|
928
|
+
|
892
929
|
sage: x = polygen(ZZ, 'x')
|
893
930
|
sage: K.<a> = NumberField(x^3 - 2)
|
894
931
|
sage: a._random_element().parent() is K
|
@@ -5311,6 +5348,23 @@ cdef class OrderElement_absolute(NumberFieldElement_absolute):
|
|
5311
5348
|
"""
|
5312
5349
|
return self._parent.number_field()(NumberFieldElement_absolute.__invert__(self))
|
5313
5350
|
|
5351
|
+
def canonical_associate(self):
|
5352
|
+
"""
|
5353
|
+
Return a canonical associate.
|
5354
|
+
|
5355
|
+
Only implemented here because order elements inherit from field elements,
|
5356
|
+
but the canonical associate implemented there does not apply here.
|
5357
|
+
|
5358
|
+
EXAMPLES::
|
5359
|
+
|
5360
|
+
sage: x = polygen(ZZ, 'x')
|
5361
|
+
sage: K = NumberField(x^3 - x + 2, 'a')
|
5362
|
+
sage: OK = K.ring_of_integers()
|
5363
|
+
sage: (OK.1).canonical_associate()
|
5364
|
+
NotImplemented
|
5365
|
+
"""
|
5366
|
+
return NotImplemented
|
5367
|
+
|
5314
5368
|
|
5315
5369
|
cdef class OrderElement_relative(NumberFieldElement_relative):
|
5316
5370
|
"""
|
@@ -5524,6 +5578,24 @@ cdef class OrderElement_relative(NumberFieldElement_relative):
|
|
5524
5578
|
R = ZZ[var]
|
5525
5579
|
return R(K(self).absolute_minpoly(var))
|
5526
5580
|
|
5581
|
+
def canonical_associate(self):
|
5582
|
+
"""
|
5583
|
+
Return a canonical associate.
|
5584
|
+
|
5585
|
+
Only implemented here because order elements inherit from
|
5586
|
+
field elements, but the canonical associate implemented there
|
5587
|
+
does not apply here.
|
5588
|
+
|
5589
|
+
EXAMPLES::
|
5590
|
+
|
5591
|
+
sage: x = ZZ['x'].0
|
5592
|
+
sage: K.<a,b> = NumberField([x^2 + 1, x^2 - 3])
|
5593
|
+
sage: OK = K.maximal_order()
|
5594
|
+
sage: (OK.1).canonical_associate()
|
5595
|
+
NotImplemented
|
5596
|
+
"""
|
5597
|
+
return NotImplemented
|
5598
|
+
|
5527
5599
|
|
5528
5600
|
class CoordinateFunction():
|
5529
5601
|
r"""
|
Binary file
|
@@ -420,7 +420,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
|
|
420
420
|
"""
|
421
421
|
Used for pickling.
|
422
422
|
|
423
|
-
TESTS
|
423
|
+
TESTS::
|
424
424
|
|
425
425
|
sage: x = polygen(ZZ, 'x')
|
426
426
|
sage: K.<a> = NumberField(x^2 - 13)
|
@@ -438,6 +438,23 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
|
|
438
438
|
return __make_NumberFieldElement_quadratic1, (self._parent, type(self), a, b, denom)
|
439
439
|
|
440
440
|
cdef int _randomize(self, num_bound, den_bound, distribution) except -1:
|
441
|
+
"""
|
442
|
+
TESTS::
|
443
|
+
|
444
|
+
sage: a = ZZ.random_element(-100, 100)
|
445
|
+
sage: while a.is_square():
|
446
|
+
....: a = ZZ.random_element(-100, 100)
|
447
|
+
sage: K = QuadraticField(a)
|
448
|
+
sage: K.random_element().parent() is K # indirect doctest
|
449
|
+
True
|
450
|
+
sage: len(set(K.random_element() for _ in range(100))) >= 40
|
451
|
+
True
|
452
|
+
|
453
|
+
Verify that :issue:`30017` is fixed::
|
454
|
+
|
455
|
+
sage: all(K.random_element().is_integral() for s in range(100))
|
456
|
+
False
|
457
|
+
"""
|
441
458
|
cdef Integer temp, denom1, denom2
|
442
459
|
|
443
460
|
# in theory, we could just generate two random numerators and
|
@@ -448,17 +465,20 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
|
|
448
465
|
# of the random element code, it's worth doing slightly more
|
449
466
|
# work to make this possible.
|
450
467
|
|
451
|
-
# normalize denominator bound
|
452
|
-
if den_bound is None or den_bound < 1:
|
453
|
-
den_bound = 1
|
454
|
-
|
455
468
|
# generate denominators
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
469
|
+
if den_bound is None:
|
470
|
+
denom1 = <Integer>(1 + abs(ZZ.random_element(distribution=distribution)))
|
471
|
+
denom2 = <Integer>(1 + abs(ZZ.random_element(distribution=distribution)))
|
472
|
+
else:
|
473
|
+
# normalize denominator bound
|
474
|
+
if den_bound < 1:
|
475
|
+
den_bound = 1
|
476
|
+
denom1 = <Integer>(ZZ.random_element(x=1,
|
477
|
+
y=den_bound+1,
|
478
|
+
distribution=distribution))
|
479
|
+
denom2 = <Integer>(ZZ.random_element(x=1,
|
480
|
+
y=den_bound+1,
|
481
|
+
distribution=distribution))
|
462
482
|
|
463
483
|
# set a, b
|
464
484
|
temp = <Integer>(ZZ.random_element(x=num_bound, distribution=distribution))
|
@@ -2383,8 +2403,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
|
|
2383
2403
|
|
2384
2404
|
TESTS::
|
2385
2405
|
|
2386
|
-
sage: import warnings
|
2387
|
-
sage: warnings.filterwarnings("ignore", category=DeprecationWarning)
|
2388
2406
|
sage: K2.<sqrt2> = QuadraticField(2)
|
2389
2407
|
sage: K3.<sqrt3> = QuadraticField(3)
|
2390
2408
|
sage: K5.<sqrt5> = QuadraticField(5)
|
@@ -2399,15 +2417,15 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
|
|
2399
2417
|
....: assert round(a+b*sqrt(5.)) == round(a+b*sqrt5), (a, b)
|
2400
2418
|
"""
|
2401
2419
|
n = self.floor()
|
2402
|
-
test = 2 * (self - n)
|
2420
|
+
test = 2 * (self - n)
|
2403
2421
|
if test < 1:
|
2404
2422
|
return n
|
2405
2423
|
elif test > 1:
|
2406
2424
|
return n + 1
|
2407
|
-
elif
|
2408
|
-
return n + 1
|
2409
|
-
else:
|
2425
|
+
elif n % 2 == 0:
|
2410
2426
|
return n
|
2427
|
+
else:
|
2428
|
+
return n + 1
|
2411
2429
|
|
2412
2430
|
|
2413
2431
|
cdef class NumberFieldElement_quadratic_sqrt(NumberFieldElement_quadratic):
|
Binary file
|