Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
sage -fiximports src/sage/schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchandler100 authored and Matthias Koeppe committed Jan 30, 2023
1 parent 9116c55 commit d52ad2c
Show file tree
Hide file tree
Showing 48 changed files with 193 additions and 101 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 Z as 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 Z as 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 Q as QQ
from sage.rings.integer_ring import Z as 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 @@ -1426,7 +1426,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
10 changes: 8 additions & 2 deletions src/sage/schemes/elliptic_curves/ell_finite_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@
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.integer import Integer
from sage.rings.integer_ring import Z as ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.polynomial.polynomial_ring import 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.arith.misc import GCD as gcd
from sage.arith.functions import lcm
from sage.arith.misc import binomial
from sage.misc.cachefunc import cached_method
from sage.groups.additive_abelian.additive_abelian_wrapper import AdditiveAbelianGroupWrapper

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
5 changes: 4 additions & 1 deletion src/sage/schemes/elliptic_curves/ell_modular_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@
from sage.modular.modsym.all import ModularSymbols
from sage.databases.cremona import parse_cremona_label

from sage.arith.all import next_prime, kronecker_symbol, prime_divisors, valuation
from sage.arith.misc import next_prime
from sage.arith.misc import kronecker as kronecker_symbol
from sage.arith.misc import prime_divisors
from sage.arith.misc import valuation
from sage.rings.infinity import unsigned_infinity as infinity
from sage.rings.integer import Integer
from sage.modular.cusps import Cusps
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 @@ -3892,7 +3892,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 @@ -2836,7 +2836,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 @@ -3257,7 +3259,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 Q as QQ

# Check the trivial case:

Expand Down
22 changes: 12 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,15 @@

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 Z as ZZ
from sage.rings.rational_field import Q as QQ
from sage.rings.integer import Integer
from sage.rings.integer_ring import IntegerRing
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 +3438,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 +6015,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 +7056,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
8 changes: 6 additions & 2 deletions src/sage/schemes/elliptic_curves/gal_reps_number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@
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.arith.misc import legendre_symbol
from sage.arith.misc import primes
from sage.sets.set import Set
from sage.rings.all import Integer, ZZ, QQ, Infinity
from sage.rings.integer import Integer
from sage.rings.integer_ring import Z as ZZ
from sage.rings.rational_field import Q as QQ
from sage.rings.infinity import Infinity


class GaloisRepresentation(SageObject):
Expand Down
23 changes: 17 additions & 6 deletions src/sage/schemes/elliptic_curves/heegner.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,25 @@
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.rings.integer_ring import Z as ZZ
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.rational_field import Q as QQ
from sage.rings.complex_double import CDF
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers
from sage.rings.real_mpfr import RealField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.number_field.number_field import QuadraticField
from sage.arith.misc import GCD as gcd
from sage.arith.misc import XGCD as xgcd
from sage.arith.functions import lcm
from sage.arith.misc import prime_divisors
from sage.arith.misc import factorial
from sage.arith.misc import binomial
from sage.rings.factorint import factor_trial_division
from sage.quadratic_forms.all import (BinaryQF,
BinaryQF_reduced_representatives)
from sage.matrix.all import MatrixSpace, matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.constructor import Matrix as matrix

from sage.modular.modsym.p1list import P1List

Expand Down Expand Up @@ -6822,7 +6833,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
3 changes: 2 additions & 1 deletion src/sage/schemes/elliptic_curves/height.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@

from sage.misc.cachefunc import cached_method
from sage.misc.mrange import cartesian_product_iterator
from sage.arith.all import lcm, factorial
from sage.arith.functions import lcm
from sage.arith.misc import factorial
from sage.ext.fast_callable import fast_callable
from sage.functions.log import log, exp
from sage.symbolic.ring import SR
Expand Down
7 changes: 6 additions & 1 deletion src/sage/schemes/elliptic_curves/hom_velusqrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,12 @@ def _random_example_for_testing():
sage: 5 <= K.order()
True
"""
from sage.all import prime_range, choice, randrange, GF, lcm, Mod
from sage.rings.fast_arith import prime_range
from sage.misc.prandom import choice
from sage.misc.prandom import randrange
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.arith.functions import lcm
from sage.rings.finite_rings.integer_mod import Mod
while True:
p = choice(prime_range(2, 100))
e = randrange(1,5)
Expand Down
8 changes: 4 additions & 4 deletions src/sage/schemes/elliptic_curves/isogeny_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def _compute(self, verbose=False):
True
"""
from sage.schemes.elliptic_curves.ell_curve_isogeny import fill_isogeny_matrix
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
from sage.sets.set import Set
self._maps = None

Expand Down Expand Up @@ -1055,7 +1055,7 @@ def _compute(self):
[0 2 0 0 0 0]
"""
algorithm = self._algorithm
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
self._maps = None
if algorithm == "database":
try:
Expand Down Expand Up @@ -1183,8 +1183,8 @@ def isogeny_degrees_cm(E, verbose=False):
print("CM case, discriminant = %s" % d)

from sage.libs.pari.all import pari
from sage.sets.all import Set
from sage.arith.all import kronecker_symbol
from sage.sets.set import Set
from sage.arith.misc import kronecker as kronecker_symbol

n = E.base_field().absolute_degree()
if not E.has_rational_cm():
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/isogeny_small_degree.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def _sporadic_Q_data(j):
....: g = E.division_polynomial(ell)
....: assert g % f == 0
"""
from sage.rings.all import RealField
from sage.rings.real_mpfr import RealField
from sage.misc.misc_c import prod
ell = sporadic_j[j]
E = EllipticCurve(j=j).short_weierstrass_model()
Expand Down
Loading

0 comments on commit d52ad2c

Please sign in to comment.