Skip to content

Commit

Permalink
gh-35033: sage.schemes: Replace imports from sage.*.all for namespace…
Browse files Browse the repository at this point in the history
… packages

    
<!-- ^^^^^
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

<!-- 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" -->
Closes #34951

### 📝 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: ...
-->
    
URL: #35033
Reported by: Matthias Köppe
Reviewer(s): Lorenz Panny
  • Loading branch information
Release Manager committed Feb 26, 2023
2 parents b6557a8 + f53eb61 commit 0847642
Show file tree
Hide file tree
Showing 48 changed files with 247 additions and 169 deletions.
2 changes: 1 addition & 1 deletion src/sage/schemes/affine/affine_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute

from sage.arith.all import gcd
from sage.arith.misc import GCD as gcd

from sage.rings.integer import Integer
from sage.rings.finite_rings.finite_field_constructor import is_PrimeFiniteField
Expand Down
6 changes: 4 additions & 2 deletions src/sage/schemes/elliptic_curves/BSD.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"Birch and Swinnerton-Dyer formulas"

from sage.arith.misc import prime_divisors
from sage.rings.all import ZZ, Infinity, QuadraticField
from sage.rings.integer_ring import ZZ
from sage.rings.infinity import Infinity
from sage.rings.number_field.number_field import QuadraticField
from sage.functions.other import ceil


Expand Down Expand Up @@ -480,7 +482,7 @@ def prove_BSD(E, verbosity=0, two_desc='mwrank', proof=None, secs_hi=5,
# We do not know BSD(E,p) for even a single p, since it's
# an open problem to show that L^r(E,1)/(Reg*Omega) is
# rational for any curve with r >= 2.
from sage.sets.all import Primes
from sage.sets.primes import Primes
BSD.primes = Primes()
if return_BSD:
BSD.rank = rank_lower_bd
Expand Down
5 changes: 4 additions & 1 deletion src/sage/schemes/elliptic_curves/cardinality.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
# ****************************************************************************
from .constructor import EllipticCurve, EllipticCurve_from_j
from sage.schemes.curves.projective_curve import Hasse_bounds
from sage.rings.all import Integer, ZZ, GF, polygen
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.polynomial.polynomial_ring import polygen
from sage.groups.generic import order_from_bounds


Expand Down
18 changes: 10 additions & 8 deletions src/sage/schemes/elliptic_curves/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
# ****************************************************************************

from sage.interfaces.magma import magma
from sage.rings.all import (Integer,
QQ,
ZZ,
IntegerRing,
is_fundamental_discriminant,
PolynomialRing)
from sage.rings.integer import Integer
from sage.rings.rational_field import QQ
from sage.rings.integer_ring import ZZ
from sage.rings.integer_ring import IntegerRing
from sage.rings.number_field.number_field import is_fundamental_discriminant
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing

from sage.misc.cachefunc import cached_function

Expand Down Expand Up @@ -124,7 +124,8 @@ def hilbert_class_polynomial(D, algorithm=None):
raise ValueError("%s is not a valid algorithm" % algorithm)

from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives
from sage.rings.all import RR, ComplexField
from sage.rings.real_mpfr import RR
from sage.rings.complex_mpfr import ComplexField
from sage.functions.all import elliptic_j

# get all primitive reduced quadratic forms, (necessary to exclude
Expand Down Expand Up @@ -623,7 +624,8 @@ def is_cm_j_invariant(j, method='new'):
True
"""
# First we check that j is an algebraic number:
from sage.rings.all import NumberFieldElement, NumberField
from sage.rings.number_field.number_field_element import NumberFieldElement
from sage.rings.number_field.number_field import NumberField
if not isinstance(j, NumberFieldElement) and j not in QQ:
raise NotImplementedError("is_cm_j_invariant() is only implemented for number field elements")

Expand Down
4 changes: 2 additions & 2 deletions src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring import polygen
cdef object x_ZZ = polygen(ZZ)
from sage.rings.polynomial.real_roots import real_roots
from sage.arith.all import prime_divisors
from sage.all import ntl
from sage.arith.misc import prime_divisors
import sage.libs.ntl.all as ntl

from sage.rings.integer cimport Integer
from sage.libs.gmp.mpz cimport *
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/ell_curve_isogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,7 @@ def __compute_omega_general(self, E, psi, psi_pr, phi, phi_pr):
# thesis are wrong, the correct formulas
# are coded below

from sage.arith.all import binomial
from sage.arith.misc import binomial

for j in range(n - 1):
psi_prpr += binomial(j+2, 2) * psi[j+2] * cur_x_pow
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/ell_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ def isogenies_prime_degree(self, l=None, max_l=31):
raise NotImplementedError("This code could be implemented for QQbar, but has not been yet.")

if l is None:
from sage.rings.all import prime_range
from sage.rings.fast_arith import prime_range
L = prime_range(max_l + 1)
else:
try:
Expand Down
22 changes: 14 additions & 8 deletions src/sage/schemes/elliptic_curves/ell_finite_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,24 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

import sage.groups.generic as generic

from sage.arith.functions import lcm
from sage.arith.misc import binomial, GCD as gcd
from sage.groups.additive_abelian.additive_abelian_wrapper import AdditiveAbelianGroupWrapper
from sage.misc.cachefunc import cached_method
from sage.rings.finite_rings.element_base import is_FiniteFieldElement
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring import polygen
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.schemes.curves.projective_curve import Hasse_bounds
from .ell_field import EllipticCurve_field
from .constructor import EllipticCurve
from sage.schemes.hyperelliptic_curves.hyperelliptic_finite_field import HyperellipticCurve_finite_field
from sage.rings.all import Integer, ZZ, PolynomialRing, GF, polygen
from sage.rings.finite_rings.element_base import is_FiniteFieldElement
import sage.groups.generic as generic

from . import ell_point
from sage.arith.all import gcd, lcm, binomial
from sage.misc.cachefunc import cached_method
from sage.groups.additive_abelian.additive_abelian_wrapper import AdditiveAbelianGroupWrapper
from .constructor import EllipticCurve
from .ell_field import EllipticCurve_field


class EllipticCurve_finite_field(EllipticCurve_field, HyperellipticCurve_finite_field):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/ell_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import sage.groups.additive_abelian.additive_abelian_group as groups
import sage.groups.generic as generic

from sage.arith.all import lcm
from sage.arith.functions import lcm
import sage.rings.all as rings
from sage.misc.cachefunc import cached_method
from sage.misc.fast_methods import WithEqualityById
Expand Down
17 changes: 10 additions & 7 deletions src/sage/schemes/elliptic_curves/ell_modular_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,22 @@
# http://www.gnu.org/licenses/
#*****************************************************************************

from sage.structure.sage_object import SageObject
from sage.modular.modsym.all import ModularSymbols
from sage.arith.misc import (kronecker as kronecker_symbol,
next_prime,
prime_divisors,
valuation)
from sage.databases.cremona import parse_cremona_label

from sage.arith.all import next_prime, kronecker_symbol, prime_divisors, valuation
from sage.misc.verbose import verbose
from sage.modular.cusps import Cusps
from sage.modular.modsym.all import ModularSymbols
from sage.rings.infinity import unsigned_infinity as infinity
from sage.rings.integer import Integer
from sage.modular.cusps import Cusps
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.misc.verbose import verbose
from sage.structure.sage_object import SageObject

from .constructor import EllipticCurve

from sage.schemes.elliptic_curves.constructor import EllipticCurve

oo = Cusps(infinity)
zero = Integer(0)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/schemes/elliptic_curves/ell_number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def height_pairing_matrix(self, points=None, precision=None, normalised=True):
RR = RealField()
else:
RR = RealField(precision)
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
M = MatrixSpace(RR, r)
mat = M()
for j in range(r):
Expand Down Expand Up @@ -3897,7 +3897,7 @@ def saturation(self, points, verbose=False,
raise ValueError("points not linearly independent in saturation()")
sat_reg = reg

from sage.rings.all import prime_range
from sage.rings.fast_arith import prime_range
if full_saturation:
if lower_ht_bound is None:
# TODO (robertwb): verify this for rank > 1
Expand Down
8 changes: 6 additions & 2 deletions src/sage/schemes/elliptic_curves/ell_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -2833,7 +2833,9 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False):
4.0000000000000000000000000000000000000000000000000000000000
"""
from sage.rings.number_field.number_field import refine_embedding
from sage.all import RealField, ComplexField, Infinity
from sage.rings.real_mpfr import RealField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.infinity import Infinity

E = self.curve()
K = E.base_ring()
Expand Down Expand Up @@ -3254,7 +3256,9 @@ def elliptic_logarithm(self, embedding=None, precision=100,
0.70448375537782208460499649302 - 0.79246725643650979858266018068*I
"""
from sage.rings.number_field.number_field import refine_embedding
from sage.rings.all import RealField, ComplexField, QQ
from sage.rings.real_mpfr import RealField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.rational_field import QQ

# Check the trivial case:

Expand Down
21 changes: 11 additions & 10 deletions src/sage/schemes/elliptic_curves/ell_rational_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@

import sage.arith.all as arith
import sage.rings.all as rings
from sage.rings.all import (
PowerSeriesRing,
infinity as oo,
ZZ, QQ,
Integer,
IntegerRing, RealField,
ComplexField, RationalField)
from sage.rings.power_series_ring import PowerSeriesRing
from sage.rings.infinity import Infinity as oo
from sage.rings.integer_ring import ZZ, IntegerRing
from sage.rings.rational_field import QQ
from sage.rings.integer import Integer
from sage.rings.real_mpfr import RealField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.rational_field import RationalField

from sage.structure.coerce import py_scalar_to_element
from sage.structure.element import Element
Expand Down Expand Up @@ -3436,7 +3437,7 @@ def Lambda(self, s, prec):
sage: E.Lambda(1.4+0.5*I, 50)
-0.354172680517... + 0.874518681720...*I
"""
from sage.all import pi
from sage.symbolic.constants import pi

s = C(s)
N = self.conductor()
Expand Down Expand Up @@ -6013,7 +6014,7 @@ def point_preprocessing(free,tor):
roots.remove(e3)
e1,e2 = roots

from sage.all import pi
from sage.symbolic.constants import pi
e = R(1).exp()
pi = R(pi)

Expand Down Expand Up @@ -7054,7 +7055,7 @@ def elliptic_curve_congruence_graph(curves):
Graph on 12 vertices
"""
from sage.graphs.graph import Graph
from sage.arith.all import lcm
from sage.arith.functions import lcm
from sage.rings.fast_arith import prime_range
from sage.misc.misc_c import prod
G = Graph()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/ell_tate_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from sage.rings.padics.factory import Qp
from sage.structure.sage_object import SageObject
from sage.structure.richcmp import richcmp, richcmp_method
from sage.arith.all import LCM
from sage.arith.functions import lcm as LCM
from sage.modular.modform.constructor import EisensteinForms, CuspForms
from sage.schemes.elliptic_curves.constructor import EllipticCurve
from sage.functions.log import log
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/ell_torsion.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# ****************************************************************************

from sage.misc.cachefunc import cached_method
from sage.rings.all import RationalField
from sage.rings.rational_field import RationalField
import sage.groups.additive_abelian.additive_abelian_wrapper as groups
from sage.structure.richcmp import richcmp_method, richcmp

Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/formal_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import sage.misc.misc as misc
import sage.rings.all as rings
from sage.rings.all import O
from sage.rings.big_oh import O


class EllipticCurveFormalGroup(SageObject):
Expand Down
3 changes: 2 additions & 1 deletion src/sage/schemes/elliptic_curves/gal_reps.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@
import sage.misc.all as misc
from sage.misc.verbose import verbose
import sage.rings.all as rings
from sage.rings.all import RealField, GF
from sage.rings.real_mpfr import RealField
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF

from math import sqrt
from sage.libs.pari.all import pari
Expand Down
13 changes: 8 additions & 5 deletions src/sage/schemes/elliptic_curves/gal_reps_number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.structure.sage_object import SageObject
from sage.rings.number_field.number_field import NumberField
from sage.arith.misc import legendre_symbol, primes
from sage.misc.functional import cyclotomic_polynomial
from sage.modules.free_module import VectorSpace
from sage.rings.finite_rings.finite_field_constructor import GF
from sage.misc.functional import cyclotomic_polynomial
from sage.arith.all import legendre_symbol, primes
from sage.rings.infinity import Infinity
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.number_field.number_field import NumberField
from sage.rings.rational_field import QQ
from sage.sets.set import Set
from sage.rings.all import Integer, ZZ, QQ, Infinity
from sage.structure.sage_object import SageObject


class GaloisRepresentation(SageObject):
Expand Down
40 changes: 22 additions & 18 deletions src/sage/schemes/elliptic_curves/heegner.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,34 @@
# https://www.gnu.org/licenses/
# ****************************************************************************


from sage.misc.misc_c import prod
from sage.misc.verbose import verbose
from sage.misc.cachefunc import cached_method

from sage.structure.sage_object import SageObject
from sage.structure.richcmp import (richcmp_method, richcmp,
richcmp_not_equal, rich_to_bool)

import sage.rings.abc
import sage.rings.number_field.number_field_element
import sage.rings.number_field.number_field as number_field
import sage.rings.all as rings
from sage.rings.all import (ZZ, GF, QQ, CDF,
Integers, RealField, ComplexField, QuadraticField)
from sage.arith.all import (gcd, xgcd, lcm, prime_divisors, factorial,
binomial)

from sage.arith.functions import lcm
from sage.arith.misc import (binomial, factorial, prime_divisors,
GCD as gcd, XGCD as xgcd)
from sage.matrix.constructor import Matrix as matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.misc.cachefunc import cached_method
from sage.misc.misc_c import prod
from sage.misc.verbose import verbose
from sage.modular.modsym.p1list import P1List
from sage.rings.complex_double import CDF
from sage.rings.complex_mpfr import ComplexField
from sage.rings.factorint import factor_trial_division
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers
from sage.rings.integer_ring import ZZ
from sage.rings.number_field.number_field import QuadraticField
from sage.rings.rational_field import QQ
from sage.rings.real_mpfr import RealField
from sage.quadratic_forms.all import (BinaryQF,
BinaryQF_reduced_representatives)
from sage.matrix.all import MatrixSpace, matrix

from sage.modular.modsym.p1list import P1List

from sage.structure.sage_object import SageObject
from sage.structure.richcmp import (richcmp_method, richcmp,
richcmp_not_equal, rich_to_bool)

###############################################################################
#
Expand Down Expand Up @@ -6822,7 +6826,7 @@ def heegner_index_bound(self, D=0, prec=5, max_height=None):
else:
H = 4*h
p = 3
from sage.all import next_prime
from sage.arith.misc import next_prime
while True:
c = H/(2*p**2) + B
if c < max_height:
Expand Down
Loading

0 comments on commit 0847642

Please sign in to comment.