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

Commit

Permalink
git grep -l 'all import QQ' src/sage | xargs sed -i.bak 's/sage[.]rin…
Browse files Browse the repository at this point in the history
…gs[.]all import QQ *$/sage.rings.rational_field import QQ/'
  • Loading branch information
Matthias Koeppe committed Sep 19, 2021
1 parent 0f2e375 commit 8a9ae7d
Show file tree
Hide file tree
Showing 43 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/sage/algebras/rational_cherednik_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from sage.sets.family import Family
from sage.monoids.indexed_free_monoid import IndexedFreeAbelianMonoid
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.all import QQ
from sage.rings.rational_field import QQ


class RationalCherednikAlgebra(CombinatorialFreeModule):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/yokonuma_hecke_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from sage.misc.cachefunc import cached_method
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.categories.algebras import Algebras
from sage.categories.rings import Rings
from sage.combinat.free_module import CombinatorialFreeModule
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/loop_crystals.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def one_dimensional_configuration_sum(self, q=None, group_components=True):
True
"""
if q is None:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
q = QQ['q'].gens()[0]
P0 = self.weight_lattice_realization().classical()
B = P0.algebra(q.parent())
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/crystals/affine_factorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def __init__(self, w, n, x = None):
cartan_type = CartanType(['A',n-1])
self._cartan_type = cartan_type
from sage.combinat.sf.sf import SymmetricFunctions
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
Sym = SymmetricFunctions(QQ)
s = Sym.schur()
support = s(w.stanley_symmetric_function()).support()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/crystals/kirillov_reshetikhin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from sage.categories.homset import Hom
from sage.categories.map import Map
from sage.rings.integer import Integer
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.combinat.crystals.affine import (AffineCrystalFromClassical,
AffineCrystalFromClassicalElement,
AffineCrystalFromClassicalAndPromotion,
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/crystals/littelmann_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def one_dimensional_configuration_sum(self, q=None, group_components=True):
True
"""
if q is None:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
q = QQ['q'].gens()[0]
#P0 = self.weight_lattice_realization().classical()
P0 = RootSystem(self.cartan_type().classical()).weight_lattice()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from sage.combinat.rigged_configurations.bij_type_C import RCToKRTBijectionTypeC
from sage.combinat.rigged_configurations.bij_type_A import KRTToRCBijectionTypeA

from sage.rings.all import QQ
from sage.rings.rational_field import QQ

class KRTToRCBijectionTypeA2Dual(KRTToRCBijectionTypeC):
r"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from sage.structure.parent import Parent
from sage.combinat.misc import IterableFunctionCall
import sage.combinat.tableau as tableau
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.categories.loop_crystals import KirillovReshetikhinCrystals
from sage.combinat.root_system.cartan_type import CartanType
from sage.combinat.rigged_configurations.kleber_tree import KleberTree, VirtualKleberTree
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/branching_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sage.structure.sage_object import SageObject
from sage.combinat.root_system.cartan_type import CartanType
from sage.modules.free_module_element import vector
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.misc.functional import is_even, is_odd


Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/cartan_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def symmetrizer(self):
# The result from is_symmetrizable needs to be scaled
# to integer coefficients
from sage.arith.all import LCM
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
scalar = LCM([QQ(x).denominator() for x in sym])
return Family( {iset[i]: ZZ(val*scalar) for i, val in enumerate(sym)} )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def _symmetric_form_matrix(self):
M = M.inverse()

if a[0] != 1:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
S = matrix([~a[0]]+[0]*(r-1))
A = cm.symmetrized_matrix().change_ring(QQ).stack(S)
else:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/macdonald.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from . import sfa
from sage.combinat.partition import Partitions_n, _Partitions
from sage.matrix.all import MatrixSpace
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.misc.all import prod
from sage.misc.cachefunc import cached_function
import functools
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/species/recursive_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#*****************************************************************************
from sage.combinat.species.species import GenericCombinatorialSpecies
from sage.combinat.species.structure import SpeciesStructureWrapper
from sage.rings.all import QQ
from sage.rings.rational_field import QQ


class CombinatorialSpeciesStructure(SpeciesStructureWrapper):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/species/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************
from .generating_series import OrdinaryGeneratingSeriesRing, ExponentialGeneratingSeriesRing, CycleIndexSeriesRing
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.structure.sage_object import SageObject
from sage.misc.cachefunc import cached_method
from sage.combinat.species.misc import accept_size
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/subword_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ def minkowski_summand(self, i):
A 0-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex
"""
G = self.group()
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
if G.coxeter_matrix().is_crystallographic():
min_sum = [[QQ(v) for v in F.extended_weight_configuration()[i]] for F in self]
else:
Expand Down Expand Up @@ -1740,7 +1740,7 @@ def brick_polytope(self, coefficients=None):
"""
BV = self.brick_vectors(coefficients=coefficients)
G = self.group()
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
if G.coxeter_matrix().is_crystallographic():
BV = [[QQ(v) for v in V] for V in BV]
else:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/words/morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_list import lazy_list
from sage.sets.set import Set
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.rings.infinity import Infinity
from sage.rings.integer_ring import IntegerRing
from sage.rings.integer import Integer
Expand Down
2 changes: 1 addition & 1 deletion src/sage/game_theory/normal_form_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@
from .parser import Parser
from sage.misc.latex import latex
from sage.misc.misc import powerset
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.structure.sage_object import SageObject
from sage.matrix.constructor import matrix
from sage.matrix.constructor import vector
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/polyhedron/base_QQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Base class for polyhedra over `\QQ`
"""

from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.misc.cachefunc import cached_method
from sage.misc.all import prod
from .base import Polyhedron_base
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/polyhedron/double_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import itertools

from sage.misc.cachefunc import cached_method
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.modules.free_module_element import vector
from sage.matrix.matrix_space import MatrixSpace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def verify(self, inequalities, equations):
sage: H = Hrep2Vrep(QQ, 1, [(1,2)], [])
sage: H.verify([(1,2)], [])
"""
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.geometry.polyhedron.constructor import Polyhedron
if self.base_ring is not QQ:
return
Expand Down Expand Up @@ -558,7 +558,7 @@ def verify(self, vertices, rays, lines):
sage: V2H = Vrep2Hrep(QQ, 2, vertices, rays, lines)
sage: V2H.verify(vertices, rays, lines)
"""
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.geometry.polyhedron.constructor import Polyhedron
if self.base_ring is not QQ:
return
Expand Down
4 changes: 2 additions & 2 deletions src/sage/interfaces/macaulay2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ def _sage_(self):
from sage.rings.integer_ring import ZZ
return ZZ
elif repr_str == "QQ":
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
return QQ

if cls_cls_str == "Type":
Expand Down Expand Up @@ -1662,7 +1662,7 @@ def _sage_(self):
from sage.rings.integer_ring import ZZ
return ZZ(repr_str)
elif cls_str == "QQ":
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
repr_str = self.external_string()
if "/" not in repr_str:
repr_str = repr_str + "/1"
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def solve_linear_system(self, A, b):
if m != len(b):
raise ValueError("dimensions of A and b must be compatible")
from sage.matrix.all import MatrixSpace
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
MS = MatrixSpace(QQ,m,1)
b = MS(list(b)) # converted b to a "column vector"
sA = self.sage2octave_matrix_string(A)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/polymake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ def str_to_base_ring(s):
return base_ring(a) + base_ring(b)*base_ring.gen()

elif 'Rational' in T1:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
base_ring = QQ
str_to_base_ring = lambda s: QQ(s)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/misc/random_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_add_commutes(trials, verbose=False):
sage: test_add_commutes(10)
sage: test_add_commutes(1000) # long time
"""
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
for _ in range(trials):
a = QQ.random_element()
b = QQ.random_element()
Expand Down Expand Up @@ -252,7 +252,7 @@ def test_add_is_mul(trials, verbose=False):
Random seed: 216390410596009428782506007128692114173
AssertionError()
"""
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
for _ in range(trials):
a = QQ.random_element()
b = QQ.random_element()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/abvar/abvar_ambient_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .abvar import (ModularAbelianVariety_modsym_abstract,
simple_factorization_of_modsym_space, modsym_lattices,
ModularAbelianVariety_modsym)
from sage.rings.all import QQ
from sage.rings.rational_field import QQ

from sage.modular.modsym.modsym import ModularSymbols
from sage.modular.modform.constructor import Newforms
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/abvar/torsion_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def _richcmp_(self, right, op):
[(1/3, 0)]
"""
A = self.parent().abelian_variety()
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
if self.__element.change_ring(QQ) - right.__element.change_ring(QQ) in A.lattice():
return rich_to_bool(op, 0)
return richcmp(self.__element, right.__element, op)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modform/j_invariant.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from .eis_series import eisenstein_series_qexp
from .vm_basis import delta_qexp
from sage.rings.all import QQ
from sage.rings.rational_field import QQ

def j_invariant_qexp(prec=10, K=QQ):
r"""
Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/modsym/heilbronn.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def hecke_images_gamma0_weight2(int u, int v, int N, indices, R):
# and #P^1(N) columns.
cdef Matrix_rational_dense T
from sage.matrix.all import matrix
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
T = matrix(QQ, len(indices), len(P1), sparse=False)
original_base_ring = R.base_ring()
if original_base_ring != QQ:
Expand Down Expand Up @@ -672,7 +672,7 @@ def hecke_images_nonquad_character_weight2(int u, int v, int N, indices, chi, R)
"""
cdef p1list.P1List P1 = p1list.P1List(N)

from sage.rings.all import QQ
from sage.rings.rational_field import QQ
K = chi.base_ring()

if K == QQ:
Expand Down Expand Up @@ -771,7 +771,7 @@ def hecke_images_quad_character_weight2(int u, int v, int N, indices, chi, R):
(0, -2, 0, 2, -2, -1)
"""
cdef p1list.P1List P1 = p1list.P1List(N)
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
if chi.base_ring() != QQ:
raise TypeError("character must takes values in QQ")

Expand Down Expand Up @@ -869,7 +869,7 @@ def hecke_images_gamma0_weight_k(int u, int v, int i, int N, int k, indices, R):
# and #P^1(N) * (k-1) columns.
cdef Matrix_rational_dense T
from sage.matrix.all import matrix
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
T = matrix(QQ, len(indices), len(P1)*(k-1), sparse=False)

if R.base_ring() != QQ:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/interactivelp_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cdef class InteractiveLPBackend:
"""

if base_ring is None:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
base_ring = QQ

self.lp = InteractiveLPProblem([], [], [], base_ring=base_ring)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/numerical/backends/logging_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def base_ring(self):
sage: lb = LoggingBackend(backend=b)
sage: lb.base_ring()
Real Double Field
sage: from sage.rings.all import QQ
sage: from sage.rings.rational_field import QQ
sage: lb = LoggingBackend(backend=b, base_ring=QQ)
sage: lb.base_ring()
Rational Field
Expand Down Expand Up @@ -232,7 +232,7 @@ def _test_{name}(cls, tester=None, **options):
tester = p._tester(**options)
'''.replace("SAGE:", "sage:") # so that the above test does not get picked up by the doctester

from sage.rings.all import QQ
from sage.rings.rational_field import QQ

def LoggingBackendFactory(solver=None, printing=True, doctest_file=None, test_method_file=None,
test_method=None, base_ring=QQ):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/matrix_sdp_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend):
self.set_sense(-1)

if base_ring is None:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
base_ring = QQ
self._base_ring = base_ring

Expand Down
4 changes: 2 additions & 2 deletions src/sage/numerical/backends/ppl_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cdef class PPLBackend(GenericBackend):
"""

if base_ring is not None:
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
if base_ring is not QQ:
raise TypeError('The PPL backend only supports rational data.')

Expand All @@ -90,7 +90,7 @@ cdef class PPLBackend(GenericBackend):
self.set_sense(-1)

cpdef base_ring(self):
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
return QQ

cpdef zero(self):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/function_field/function_field_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.structure.factory import UniqueFactory
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
from sage.misc.cachefunc import cached_method

from sage.rings.valuation.valuation import DiscreteValuation, DiscretePseudoValuation, InfiniteDiscretePseudoValuation, NegativeInfiniteDiscretePseudoValuation
Expand Down Expand Up @@ -1247,7 +1247,7 @@ def scale(self, scalar):
3 * (x)-adic valuation (in Rational function field in x over Finite Field of size 2 after x |--> 1/x)
"""
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
if scalar in QQ and scalar > 0 and scalar != 1:
return self.domain().valuation((self._base_valuation.scale(scalar), self._to_base, self._from_base))
return super(FunctionFieldMappedValuation_base, self).scale(scalar)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/number_field/morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def preimage(self, y):
V,VtoK,KtoV = self.domain().absolute_vector_space()
# construct the transformation matrix from K to L by making the columns be the image of the basis of V_K in V_L using the homomorphism
from sage.matrix.constructor import matrix
from sage.rings.all import QQ
from sage.rings.rational_field import QQ
M = matrix(QQ, [LtoV(self(VtoK(e))) for e in V.basis()]).transpose()
self._transformation_data = (M,LtoV,VtoK)

Expand Down
Loading

0 comments on commit 8a9ae7d

Please sign in to comment.