Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Jul 25, 2022
2 parents d05da12 + 309726f commit aa531a8
Show file tree
Hide file tree
Showing 34 changed files with 101 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/sage/rings/asymptotic/asymptotic_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
from sage.structure.unique_representation import UniqueRepresentation
from sage.misc.defaults import series_precision
import sage.rings.abc
from sage.rings.all import RIF
from sage.rings.real_mpfi import RIF
from .misc import WithLocals


Expand Down
7 changes: 6 additions & 1 deletion src/sage/rings/asymptotic/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,14 @@ def parent_to_repr_short(P):
sage: parent_to_repr_short(Zmod(3)['g'])
'Univariate Polynomial Ring in g over Ring of integers modulo 3'
"""
from sage.rings.all import RR, CC, RIF, CIF, RBF, CBF
from sage.rings.cc import CC
from sage.rings.cif import CIF
from sage.rings.complex_arb import CBF
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RBF
from sage.rings.real_mpfi import RIF
from sage.rings.real_mpfr import RR
from sage.symbolic.ring import SR
from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing
Expand Down
4 changes: 3 additions & 1 deletion src/sage/rings/complex_arb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
emb = other.coerce_embedding()
return emb is not None and self.has_coerce_map_from(emb.codomain())

from sage.rings.all import QQ, AA, QQbar, RLF, CLF
from sage.rings.qqbar import AA, QQbar
from sage.rings.real_lazy import RLF, CLF

if other in [AA, QQbar, RLF, CLF]:
return True

Expand Down
4 changes: 3 additions & 1 deletion src/sage/rings/finite_rings/residue_field.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ from sage.rings.rational cimport Rational
from sage.categories.homset import Hom
from sage.categories.basic import Fields, Rings
from sage.categories.pushout import AlgebraicExtensionFunctor
from sage.rings.all import ZZ, QQ, Integers
from sage.rings.finite_rings.integer_mod_ring import Integers
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.finite_rings.finite_field_constructor import zech_log_bound, FiniteField as GF
from sage.rings.finite_rings.finite_field_givaro import FiniteField_givaro
from sage.rings.finite_rings.finite_field_ntl_gf2e import FiniteField_ntl_gf2e
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/fraction_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ def function_field(self):
:meth:`sage.rings.function_field.RationalFunctionField.field`
"""
from sage.rings.all import FunctionField
from sage.rings.function_field.constructor import FunctionField
return FunctionField(self.base_ring(), names=self.variable_name())

def _coerce_map_from_(self, R):
Expand All @@ -1058,7 +1058,7 @@ def _coerce_map_from_(self, R):
"""
from sage.rings.function_field.function_field import RationalFunctionField
if isinstance(R, RationalFunctionField) and self.variable_name() == R.variable_name() and self.base_ring() is R.constant_base_field():
from sage.categories.all import Hom
from sage.categories.homset import Hom
parent = Hom(R, self)
from sage.rings.function_field.maps import FunctionFieldToFractionField
return parent.__make_element_class__(FunctionFieldToFractionField)(parent)
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def section(self):
"""
from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
from sage.all import Hom
from sage.categories.all import Hom
parent = Hom(self.codomain(), self.domain(), SetsWithPartialMaps())
return parent.__make_element_class__(FractionFieldEmbeddingSection)(self)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/function_field/function_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -3436,7 +3436,7 @@ def number_of_rational_places(self, r=1):
sage: [F.number_of_rational_places(r) for r in [1..10]]
[4, 8, 4, 16, 44, 56, 116, 288, 508, 968]
"""
from sage.rings.all import IntegerRing
from sage.rings.integer_ring import IntegerRing

q = self.constant_field().order()
L = self.L_polynomial()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/lazy_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2973,12 +2973,12 @@ def approximate_series(self, prec, name=None):
name = S.variable_name()

if self.valuation() < 0:
from sage.rings.all import LaurentSeriesRing
from sage.rings.laurent_series_ring import LaurentSeriesRing
R = LaurentSeriesRing(S.base_ring(), name=name)
n = self.valuation()
return R([self[i] for i in range(n, prec)], n).add_bigoh(prec)
else:
from sage.rings.all import PowerSeriesRing
from sage.rings.power_series_ring import PowerSeriesRing
R = PowerSeriesRing(S.base_ring(), name=name)
return R([self[i] for i in range(prec)]).add_bigoh(prec)

Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/number_field/S_unit_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# ****************************************************************************


from sage.rings.all import Infinity
from sage.rings.infinity import Infinity
from sage.misc.lazy_import import lazy_import
lazy_import("sage.symbolic.ring", "SR")
from sage.rings.integer import Integer
Expand All @@ -71,11 +71,11 @@
from sage.rings.padics.factory import Qp
from sage.combinat.combination import Combinations
from sage.misc.misc_c import prod
from sage.arith.all import factorial
from sage.arith.functions import lcm
from sage.arith.misc import gcd, CRT, factorial
from sage.matrix.constructor import matrix, identity_matrix, vector, block_matrix, zero_matrix
from sage.modules.free_module_element import zero_vector
from itertools import combinations_with_replacement
from sage.arith.all import gcd, lcm, CRT
from copy import copy
import itertools

Expand Down
3 changes: 2 additions & 1 deletion src/sage/rings/number_field/bdd_height.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
from sage.modules.free_module_element import vector
from sage.matrix.constructor import column_matrix
from sage.rings.rational_field import QQ
from sage.rings.all import RR, Infinity
from sage.rings.infinity import Infinity
from sage.rings.real_mpfr import RR
from sage.geometry.polyhedron.constructor import Polyhedron


Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/number_field/class_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def representative_prime(self, norm_bound=1000):
# otherwise we just search:
Cl = self.parent()
K = Cl.number_field()
from sage.rings.all import RR
from sage.rings.real_mpfr import RR
for P in K.primes_of_bounded_norm_iter(RR(norm_bound)):
if Cl(P)==c:
return P
Expand Down
26 changes: 15 additions & 11 deletions src/sage/rings/number_field/number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
from sage.misc.functional import is_odd, lift

from sage.misc.misc_c import prod
from sage.rings.all import Infinity
from sage.rings.infinity import Infinity
from sage.categories.number_fields import NumberFields

import sage.rings.ring
Expand Down Expand Up @@ -1635,7 +1635,7 @@ def construction(self):
"""
from sage.categories.pushout import AlgebraicExtensionFunctor
from sage.all import QQ
from sage.rings.rational_field import QQ
names = self.variable_names()
polys = []
embeddings = []
Expand Down Expand Up @@ -3293,7 +3293,8 @@ def algebraic_closure(self):
sage: K.algebraic_closure()
Algebraic Field
"""
return sage.rings.all.QQbar
from sage.rings.qqbar import QQbar
return QQbar

@cached_method
def conductor(self, check_abelian=True):
Expand Down Expand Up @@ -6810,7 +6811,7 @@ def regulator(self, proof=None):
try:
return self.__regulator
except AttributeError:
from sage.rings.all import RealField
from sage.rings.real_mpfr import RealField
k = self.pari_bnf(proof)
self.__regulator = RealField(53)(k.bnf_get_reg())
return self.__regulator
Expand Down Expand Up @@ -8119,7 +8120,8 @@ def _coerce_from_other_number_field(self, x):

# Do not use CDF or RDF because of constraints on the
# exponent of floating-point numbers
from sage.rings.all import RealField, ComplexField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.real_mpfr import RealField
CC = ComplexField(53)
RR = RealField(53)

Expand Down Expand Up @@ -9372,8 +9374,9 @@ def places(self, all_complex=False, prec=None):
C = sage.rings.complex_double.CDF

elif prec == Infinity:
R = sage.rings.all.AA
C = sage.rings.all.QQbar
from sage.rings.qqbar import AA, QQbar
R = AA
C = QQbar

else:
R = sage.rings.real_mpfr.RealField(prec)
Expand Down Expand Up @@ -9670,7 +9673,8 @@ def relativize(self, alpha, names, structure=None):
# step 1: construct the abstract field generated by alpha.w
# step 2: make a relative extension of it.
# step 3: construct isomorphisms
from sage.all import vector, matrix
from sage.matrix.constructor import matrix
from sage.modules.free_module_element import vector

from sage.categories.map import is_Map
if is_Map(alpha):
Expand All @@ -9680,7 +9684,7 @@ def relativize(self, alpha, names, structure=None):
L = alpha.domain()
alpha = alpha(L.gen()) # relativize over phi's domain
if L is QQ:
from sage.rings.all import polygen
from sage.rings.polynomial.polynomial_ring import polygen
f = polygen(QQ)
else:
f = L.defining_polynomial() # = alpha.minpoly()
Expand Down Expand Up @@ -10036,13 +10040,13 @@ def hilbert_symbol(self, a, b, P = None):
return pari(self).nfhilbert(a, b)

from sage.categories.map import Map
from sage.categories.all import Rings
from sage.categories.rings import Rings
if isinstance(P, Map) and P.category_for().is_subcategory(Rings()):
# P is a morphism of Rings
if P.domain() is not self:
raise ValueError("Domain of P (=%s) should be self (=%s) in self.hilbert_symbol" % (P, self))
codom = P.codomain()
from sage.rings.all import (AA, QQbar)
from sage.rings.qqbar import AA, QQbar
if isinstance(codom, (sage.rings.abc.ComplexField, sage.rings.abc.ComplexDoubleField, sage.rings.abc.ComplexIntervalField)) or \
codom is QQbar:
if P(self.gen()).imag() == 0:
Expand Down
6 changes: 5 additions & 1 deletion src/sage/rings/number_field/number_field_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,11 @@ cdef class NumberFieldElement(FieldElement):
from .number_field import NumberField_cyclotomic
if isinstance(K, NumberField_cyclotomic):
# solution by radicals may be difficult, but we have a closed form
from sage.all import exp, I, pi, ComplexField, RR
from sage.functions.log import exp
from sage.rings.complex_mpfr import ComplexField
from sage.rings.imaginary_unit import I
from sage.rings.real_mpfr import RR
from sage.symbolic.constants import pi
CC = ComplexField(53)
two_pi_i = 2 * pi * I
k = ( K._n()*CC(K.gen()).log() / CC(two_pi_i) ).real().round() # n ln z / (2 pi i)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/number_field/number_field_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2731,7 +2731,7 @@ def ideallog(self, x, gens=None, check=True):
ans = N.hermite_form()[0, 1:].list()

if check:
from sage.rings.all import Zmod
from sage.rings.finite_rings.integer_mod_ring import Zmod
Z_norm = Zmod(self.norm().numerator()) # norm is an integer ?
t = 1
for gi, ai in zip(gens, ans):
Expand Down
10 changes: 6 additions & 4 deletions src/sage/rings/number_field/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,13 +1786,13 @@ def _assume_maximal(self, is_maximal=True, p=None):
self.__is_maximal = False
elif is_maximal:
if self._is_maximal() is False:
raise ValueError(f"cannot assume this order to be maximal because we already found it to be a non-maximal order")
raise ValueError("cannot assume this order to be maximal because we already found it to be a non-maximal order")
self.__is_maximal = True
# No need to keep information at specific primes anymore.
self.__is_maximal_at = {}
else:
if self._is_maximal() is True:
raise ValueError(f"cannot assume this order to be non-maximal because we already found it to be a maximal order")
raise ValueError("cannot assume this order to be non-maximal because we already found it to be a maximal order")
self.__is_maximal = False
else:
p = ZZ(p).abs()
Expand Down Expand Up @@ -2752,7 +2752,8 @@ def GaussianIntegers(names="I", latex_name="i"):
sage: GaussianIntegers().basis()
[1, I]
"""
from sage.rings.all import CDF, NumberField
from sage.rings.complex_double import CDF
from sage.rings.number_field.number_field import NumberField
f = ZZ['x']([1, 0, 1])
nf = NumberField(f, names, embedding=CDF(0, 1), latex_name=latex_name)
return nf.ring_of_integers()
Expand Down Expand Up @@ -2780,7 +2781,8 @@ def EisensteinIntegers(names="omega"):
sage: EisensteinIntegers().basis()
[1, omega]
"""
from sage.rings.all import CDF, NumberField
from sage.rings.complex_double import CDF
from sage.rings.number_field.number_field import NumberField
f = ZZ['x']([1, 1, 1])
nf = NumberField(f, names, embedding=CDF(-0.5, 0.8660254037844386))
return nf.ring_of_integers()
2 changes: 1 addition & 1 deletion src/sage/rings/padics/local_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ def _test_matrix_smith(self, **options):
tester.assertEqual(self.residue_field().characteristic(), self.residue_characteristic())

from itertools import chain
from sage.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
from .precision_error import PrecisionError
matrices = chain(*[MatrixSpace(self, n, m).some_elements() for n in (1,3,7) for m in (1,4,7)])
for M in tester.some_elements(matrices):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ from sage.rings.padics.padic_generic_element cimport pAdicGenericElement
from sage.libs.pari.all import pari_gen
from sage.interfaces.gp import GpElement
from sage.rings.finite_rings.integer_mod import is_IntegerMod
from sage.rings.all import IntegerModRing
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
from sage.rings.padics.padic_ext_element cimport pAdicExtElement
from sage.rings.padics.precision_error import PrecisionError

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ from sage.rings.rational cimport Rational
from sage.libs.pari.all import pari_gen
from sage.interfaces.gp import GpElement
from sage.rings.finite_rings.integer_mod import is_IntegerMod
from sage.rings.all import IntegerModRing
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
from sage.rings.padics.pow_computer_ext cimport PowComputer_ZZ_pX_FM_Eis


Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/padic_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ def simplify(self, x, error=None, force=False, size_heuristic_bound=32):
return self.domain().zero()

from sage.rings.rational_field import QQ
from sage.rings.all import Qp
from sage.rings.padics.factory import Qp
precision_ring = Qp(self.p(), QQ(error).floor() + 1 - v)
reduced = precision_ring(x)
lift = (reduced >> v).lift()
Expand Down
5 changes: 3 additions & 2 deletions src/sage/rings/polynomial/hilbert.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,9 @@ def first_hilbert_series(I, grading=None, return_grading=False):
sage: first_hilbert_series(singular(I))
0
"""
from sage.all import ZZ, PolynomialRing
PR = PolynomialRing(ZZ,'t')
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
PR = PolynomialRing(ZZ, 't')
cdef Node AN
# The "active node". If a recursive computation is needed, it will be equipped
# with a 'Left' and a 'Right' child node, and some 'Multipliers'. Later, the first Hilbert
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/polynomial/infinite_polynomial_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def InfinitePolynomial(A, p):
alpha_2^2 + alpha_1^2
"""
from sage.all import parent
from sage.structure.element import parent
if hasattr(A,'_P'):
if parent(p) is A._P or (A._P.base_ring().has_coerce_map_from(parent(p))):
return InfinitePolynomial_dense(A, p)
Expand Down Expand Up @@ -826,7 +826,7 @@ def _richcmp_(self, x, op):
# but of course the underlying polynomial rings
# may be widely different, and the sage coercion
# system can't guess what order we want.
from sage.all import parent
from sage.structure.element import parent
R1 = parent(self._p)
R2 = parent(x._p)
if (hasattr(R1,'has_coerce_map_from') and R1.has_coerce_map_from(R2)) or (hasattr(R2,'has_coerce_map_from') and R2.has_coerce_map_from(R1)):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/polynomial/infinite_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ def krull_dimension(self, *args, **kwds):
sage: R.krull_dimension()
+Infinity
"""
from sage.rings.all import Infinity
from sage.rings.infinity import Infinity
return Infinity

def order(self):
Expand All @@ -1351,7 +1351,7 @@ def order(self):
sage: R.order()
+Infinity
"""
from sage.rings.all import Infinity
from sage.rings.infinity import Infinity
return Infinity


Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/multi_polynomial_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ def _groebner_basis_ginv(self, algorithm="TQ", criteria='CritPartially', divisio
except KeyError:
raise NotImplementedError("Term order '%s' not supported by Sage's GINV interface or GINV"%T.term_order())

from sage.all import QQ
from sage.rings.rational_field import QQ
if K is QQ:
ic = ginv.CoeffInterface("GmpQ", st)
elif K.order() <= 2**16 and K.order().is_prime():
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/polynomial_gf2x.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ cdef class Polynomial_GF2X(Polynomial_template):
from sage.misc.verbose import verbose
from sage.functions.all import ceil
from sage.matrix.constructor import Matrix
from sage.rings.all import FiniteField as GF
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF

cdef Polynomial_GF2X res
cdef GF2XModulus_c modulus
Expand Down
Loading

0 comments on commit aa531a8

Please sign in to comment.