From 7d042415e05572967832d688f8ef939397793b54 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Sep 2023 20:25:37 -0700 Subject: [PATCH] Replace relative imports in Cython files --- src/sage/categories/action.pyx | 4 +-- src/sage/categories/functor.pyx | 2 +- src/sage/categories/map.pyx | 2 +- src/sage/categories/morphism.pyx | 2 +- src/sage/coding/ag_code_decoders.pyx | 4 +-- src/sage/combinat/designs/designs_pyx.pyx | 2 +- .../designs/evenly_distributed_sets.pyx | 2 +- .../orthogonal_arrays_find_recursive.pyx | 28 +++++++-------- src/sage/cpython/wrapperdescr.pyx | 2 +- src/sage/graphs/base/graph_backends.pyx | 6 ++-- src/sage/groups/matrix_gps/group_element.pyx | 2 +- src/sage/libs/gap/element.pyx | 4 +-- src/sage/libs/gap/util.pyx | 2 +- src/sage/libs/mpmath/ext_libmp.pyx | 2 +- src/sage/libs/ntl/ntl_GF2E.pyx | 2 +- src/sage/libs/ntl/ntl_GF2EX.pyx | 4 +-- src/sage/libs/ntl/ntl_GF2X.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pEContext.pyx | 4 +-- src/sage/libs/ntl/ntl_mat_GF2E.pyx | 2 +- src/sage/libs/ntl/ntl_mat_ZZ.pyx | 2 +- src/sage/libs/pari/convert_sage.pyx | 2 +- src/sage/matrix/action.pyx | 2 +- src/sage/matrix/args.pyx | 4 +-- src/sage/matrix/change_ring.pyx | 2 +- src/sage/matrix/constructor.pyx | 2 +- src/sage/matrix/matrix0.pyx | 20 +++++------ src/sage/matrix/matrix2.pyx | 10 +++--- src/sage/matrix/matrix_cyclo_dense.pyx | 10 +++--- src/sage/matrix/matrix_double_dense.pyx | 2 +- src/sage/matrix/matrix_generic_dense.pyx | 2 +- src/sage/matrix/matrix_generic_sparse.pyx | 2 +- src/sage/matrix/matrix_integer_dense.pyx | 32 ++++++++--------- src/sage/matrix/matrix_integer_sparse.pyx | 6 ++-- src/sage/matrix/matrix_modn_sparse.pyx | 4 +-- src/sage/matrix/matrix_rational_dense.pyx | 8 ++--- src/sage/matrix/matrix_rational_sparse.pyx | 2 +- src/sage/matrix/matrix_real_double_dense.pyx | 2 +- src/sage/matrix/matrix_symbolic_dense.pyx | 2 +- src/sage/matrix/matrix_symbolic_sparse.pyx | 2 +- src/sage/matroids/basis_exchange_matroid.pyx | 4 +-- .../matroids/circuit_closures_matroid.pyx | 2 +- src/sage/matroids/matroid.pyx | 26 +++++++------- src/sage/matroids/unpickling.pyx | 6 ++-- src/sage/misc/lazy_import.pyx | 6 ++-- src/sage/misc/persist.pyx | 6 ++-- src/sage/misc/sage_timeit_class.pyx | 2 +- src/sage/modular/modsym/heilbronn.pyx | 2 +- src/sage/modular/pollack_stevens/dist.pyx | 2 +- src/sage/modules/free_module_element.pyx | 10 +++--- src/sage/modules/vector_double_dense.pyx | 2 +- src/sage/modules/vector_numpy_dense.pyx | 2 +- src/sage/plot/plot3d/base.pyx | 8 ++--- src/sage/plot/plot3d/index_face_set.pyx | 2 +- src/sage/plot/plot3d/parametric_surface.pyx | 2 +- src/sage/plot/plot3d/shapes.pyx | 6 ++-- src/sage/rings/complex_double.pyx | 34 +++++++++---------- src/sage/rings/complex_interval.pyx | 6 ++-- src/sage/rings/complex_mpc.pyx | 10 +++--- src/sage/rings/complex_mpfr.pyx | 10 +++--- .../rings/finite_rings/element_ntl_gf2e.pyx | 4 +-- .../rings/finite_rings/element_pari_ffelt.pyx | 2 +- .../rings/finite_rings/finite_field_base.pyx | 12 +++---- .../rings/finite_rings/hom_finite_field.pyx | 2 +- src/sage/rings/finite_rings/integer_mod.pyx | 14 ++++---- src/sage/rings/finite_rings/residue_field.pyx | 12 +++---- src/sage/rings/fraction_field_element.pyx | 2 +- src/sage/rings/function_field/element.pyx | 2 +- .../rings/function_field/element_polymod.pyx | 2 +- .../rings/function_field/element_rational.pyx | 2 +- src/sage/rings/integer.pyx | 6 ++-- src/sage/rings/integer_ring.pyx | 2 +- .../rings/laurent_series_ring_element.pyx | 2 +- src/sage/rings/morphism.pyx | 34 +++++++++---------- .../number_field/number_field_element.pyx | 20 +++++------ .../number_field_element_quadratic.pyx | 6 ++-- .../number_field/number_field_morphisms.pyx | 2 +- .../rings/number_field/totallyreal_data.pyx | 2 +- src/sage/rings/padics/morphism.pyx | 2 +- src/sage/rings/padics/padic_printing.pyx | 2 +- src/sage/rings/padics/pow_computer.pyx | 8 ++--- src/sage/rings/padics/pow_computer_flint.pyx | 8 ++--- .../multi_polynomial_libsingular.pyx | 2 +- .../polynomial/multi_polynomial_ring_base.pyx | 24 ++++++------- .../rings/polynomial/polynomial_element.pyx | 2 +- .../polynomial/polynomial_number_field.pyx | 2 +- src/sage/rings/power_series_mpoly.pyx | 6 ++-- src/sage/rings/power_series_poly.pyx | 2 +- src/sage/rings/power_series_ring_element.pyx | 6 ++-- src/sage/rings/rational.pyx | 10 +++--- src/sage/rings/real_double.pyx | 14 ++++---- src/sage/rings/real_double_element_gsl.pyx | 4 +-- src/sage/rings/real_mpfi.pyx | 4 +-- src/sage/rings/real_mpfr.pyx | 22 ++++++------ src/sage/rings/ring.pyx | 2 +- src/sage/rings/sum_of_squares.pyx | 2 +- src/sage/sat/solvers/satsolver.pyx | 8 ++--- src/sage/structure/coerce.pyx | 2 +- src/sage/structure/coerce_actions.pyx | 2 +- src/sage/structure/parent.pyx | 6 ++-- src/sage/structure/parent_base.pyx | 2 +- src/sage/symbolic/expression.pyx | 8 ++--- src/sage/symbolic/function.pyx | 10 +++--- src/sage/symbolic/pynac_impl.pxi | 12 +++---- src/sage/symbolic/ring.pyx | 4 +-- 104 files changed, 324 insertions(+), 324 deletions(-) diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index a09dab3a20e..f30dfe671e1 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -63,7 +63,7 @@ from sage.categories.map cimport Map from sage.structure.element cimport parent from sage.structure.parent cimport Parent -from . import homset +from sage.categories import homset from weakref import ref @@ -92,7 +92,7 @@ cdef class Action(Functor): :class:`Action` itself, but other classes may use it """ def __init__(self, G, S, is_left=True, op=None): - from .groupoid import Groupoid + from sage.categories.groupoid import Groupoid Functor.__init__(self, Groupoid(G), category(S)) self.G = G self.US = ref(S) diff --git a/src/sage/categories/functor.pyx b/src/sage/categories/functor.pyx index bd0ab85fe44..ff9b51c656d 100644 --- a/src/sage/categories/functor.pyx +++ b/src/sage/categories/functor.pyx @@ -34,7 +34,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import category +from sage.categories import category def _Functor_unpickle(Cl, D, domain, codomain): diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 9299d329c10..bf8607437e0 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -22,7 +22,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import homset +from sage.categories import homset import weakref from sage.ext.stdsage cimport HAS_DICTIONARY from sage.arith.power cimport generic_power diff --git a/src/sage/categories/morphism.pyx b/src/sage/categories/morphism.pyx index f4c7fa9af69..80da0b140d3 100644 --- a/src/sage/categories/morphism.pyx +++ b/src/sage/categories/morphism.pyx @@ -468,7 +468,7 @@ cdef class CallMorphism(Morphism): cdef class IdentityMorphism(Morphism): def __init__(self, parent): - from .homset import Homset, Hom + from sage.categories.homset import Homset, Hom if not isinstance(parent, Homset): parent = Hom(parent, parent) Morphism.__init__(self, parent) diff --git a/src/sage/coding/ag_code_decoders.pyx b/src/sage/coding/ag_code_decoders.pyx index 5e2edeec04e..1a4a860eb19 100644 --- a/src/sage/coding/ag_code_decoders.pyx +++ b/src/sage/coding/ag_code_decoders.pyx @@ -68,8 +68,8 @@ from sage.rings.function_field.constructor import FunctionField from sage.modules.free_module_element import vector from sage.matrix.constructor import matrix -from .encoder import Encoder -from .decoder import Decoder, DecodingError +from sage.coding.encoder import Encoder +from sage.coding.decoder import Decoder, DecodingError from sage.modules.free_module_element cimport FreeModuleElement from sage.matrix.matrix cimport Matrix diff --git a/src/sage/combinat/designs/designs_pyx.pyx b/src/sage/combinat/designs/designs_pyx.pyx index 24dd0f8cfc2..fc3a8328420 100644 --- a/src/sage/combinat/designs/designs_pyx.pyx +++ b/src/sage/combinat/designs/designs_pyx.pyx @@ -606,7 +606,7 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False): Column 1 contains 2 empty entries instead of the expected lambda.u=1.1=1 False """ - from .difference_family import group_law + from sage.combinat.designs.difference_family import group_law assert k>=2 assert lmbda >=1 diff --git a/src/sage/combinat/designs/evenly_distributed_sets.pyx b/src/sage/combinat/designs/evenly_distributed_sets.pyx index b547c910d8a..d2252e95f8c 100644 --- a/src/sage/combinat/designs/evenly_distributed_sets.pyx +++ b/src/sage/combinat/designs/evenly_distributed_sets.pyx @@ -311,7 +311,7 @@ cdef class EvenlyDistributedSetsBacktracker: xe = self.K.multiplicative_generator() ** (self.e) df = [[xe**j*b for b in B] for j in range((self.q-1)/(2*self.e))] if check: - from .difference_family import is_difference_family + from sage.combinat.designs.difference_family import is_difference_family if not is_difference_family(self.K, df, self.q, self.k, 1): raise RuntimeError("a wrong evenly distributed set was " "produced by the Sage library for the parameters:\n" diff --git a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx index dba5e675148..f1f1cd53160 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +++ b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx @@ -48,7 +48,7 @@ Functions """ from sage.misc.cachefunc import cached_function -from .orthogonal_arrays import orthogonal_array +from sage.combinat.designs.orthogonal_arrays import orthogonal_array from sage.rings.integer cimport smallInteger from sage.arith.misc import prime_powers @@ -152,7 +152,7 @@ cpdef find_product_decomposition(int k,int n): # faster to use that rather than calling the divisors function continue if is_available(k, n1) and is_available(k, n2): - from .orthogonal_arrays import wilson_construction + from sage.combinat.designs.orthogonal_arrays import wilson_construction return wilson_construction, (None,k,n1,n2,(),False) return False @@ -202,7 +202,7 @@ cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n): is_available(k ,m+1) and is_available(k+1,r ) and is_available(k ,u )): - from .orthogonal_arrays import wilson_construction + from sage.combinat.designs.orthogonal_arrays import wilson_construction return wilson_construction, (None,k,r,m,(u,),False) return False @@ -265,7 +265,7 @@ cpdef find_wilson_decomposition_with_two_truncated_groups(int k,int n): r2 = r1_p_r2-r1 if is_available(k,r2): assert n == r*m+r1+r2 - from .orthogonal_arrays import wilson_construction + from sage.combinat.designs.orthogonal_arrays import wilson_construction return wilson_construction, (None,k,r,m,(r1,r2),False) return False @@ -305,7 +305,7 @@ cpdef find_construction_3_3(int k,int n): if (is_available(k+i, nn ) and is_available(k , mm+i)): - from .orthogonal_arrays_build_recursive import construction_3_3 + from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_3 return construction_3_3, (k,nn,mm,i) cpdef find_construction_3_4(int k,int n): @@ -348,7 +348,7 @@ cpdef find_construction_3_4(int k,int n): if (is_available(k+r+1,nn) and is_available(k , s) and (is_available(k,mm+r) or is_available(k,mm+r+1))): - from .orthogonal_arrays_build_recursive import construction_3_4 + from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_4 return construction_3_4, (k,nn,mm,r,s) cpdef find_construction_3_5(int k,int n): @@ -398,7 +398,7 @@ cpdef find_construction_3_5(int k,int n): (r==0 or is_available(k,r)) and (s==0 or is_available(k,s)) and (t==0 or is_available(k,t))): - from .orthogonal_arrays_build_recursive import construction_3_5 + from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_5 return construction_3_5, (k,nn,mm,r,s,t) cpdef find_construction_3_6(int k,int n): @@ -439,7 +439,7 @@ cpdef find_construction_3_6(int k,int n): if (is_available(k+i,nn) and smallInteger(nn).is_prime_power()): - from .orthogonal_arrays_build_recursive import construction_3_6 + from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_6 return construction_3_6, (k,nn,mm,i) cpdef find_q_x(int k,int n): @@ -491,7 +491,7 @@ cpdef find_q_x(int k,int n): # is_available(k+1,q) and is_available(k, x+2 ) and smallInteger(q).is_prime_power()): - from .orthogonal_arrays_build_recursive import construction_q_x + from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_q_x return construction_q_x, (k,q,x) return False @@ -545,7 +545,7 @@ cpdef find_thwart_lemma_3_5(int k,int N): sage: for k,n in kn: # not tested -- too long ....: assert designs.orthogonal_array(k,n,existence=True) is True """ - from .orthogonal_arrays_build_recursive import thwart_lemma_3_5 + from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_3_5 cdef int n,m,a,b,c,d,NN,na,nb,nc for n in prime_powers(k+2,N-2): # There must exist a OA(k+3,n) thus n>=k+2 @@ -660,7 +660,7 @@ cpdef find_thwart_lemma_4_1(int k,int n): not is_available(k,mm+4)): continue - from .orthogonal_arrays_build_recursive import thwart_lemma_4_1 + from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_4_1 return thwart_lemma_4_1,(k,nn,mm) return False @@ -705,7 +705,7 @@ cpdef find_three_factor_product(int k,int n): not is_available(k,n2) or not is_available(k,n3)): continue - from .orthogonal_arrays_build_recursive import three_factor_product + from sage.combinat.designs.orthogonal_arrays_build_recursive import three_factor_product return three_factor_product,(k-1,n1,n2,n3) return False @@ -730,7 +730,7 @@ cpdef find_brouwer_separable_design(int k,int n): sage: find_brouwer_separable_design(5,14) False """ - from .orthogonal_arrays_build_recursive import brouwer_separable_design + from sage.combinat.designs.orthogonal_arrays_build_recursive import brouwer_separable_design cdef int q,x,baer_subplane_size, max_t, min_t, t,e1,e2,e3,e4 for q in prime_powers(2,n): @@ -943,7 +943,7 @@ cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n): values = int_as_sum(remainder, available_multipliers, r) if values is not None: - from .orthogonal_arrays import wilson_construction + from sage.combinat.designs.orthogonal_arrays import wilson_construction return (wilson_construction, (None,k,r,m,[[(x,1) for x in values]])) diff --git a/src/sage/cpython/wrapperdescr.pyx b/src/sage/cpython/wrapperdescr.pyx index a5233fdfb55..1e74353e798 100644 --- a/src/sage/cpython/wrapperdescr.pyx +++ b/src/sage/cpython/wrapperdescr.pyx @@ -31,7 +31,7 @@ Pure Python classes have normal methods, not slot wrappers:: # https://www.gnu.org/licenses/ # **************************************************************************** -from .string import bytes_to_str +from sage.cpython.string import bytes_to_str def wrapperdescr_call(slotwrapper, self, *args, **kwds): diff --git a/src/sage/graphs/base/graph_backends.pyx b/src/sage/graphs/base/graph_backends.pyx index 2c91d7df9b1..386f1ade567 100644 --- a/src/sage/graphs/base/graph_backends.pyx +++ b/src/sage/graphs/base/graph_backends.pyx @@ -723,9 +723,9 @@ cdef class GenericGraphBackend(SageObject): sage: loads(dumps(gi)) == gi True """ - from .static_sparse_backend import StaticSparseBackend - from .sparse_graph import SparseGraphBackend - from .dense_graph import DenseGraphBackend + from sage.graphs.base.static_sparse_backend import StaticSparseBackend + from sage.graphs.base.sparse_graph import SparseGraphBackend + from sage.graphs.base.dense_graph import DenseGraphBackend # implementation, data_structure, multiedges, directed, loops if isinstance(self, CGraphBackend): diff --git a/src/sage/groups/matrix_gps/group_element.pyx b/src/sage/groups/matrix_gps/group_element.pyx index d1129ebb2a6..c123d0d1820 100644 --- a/src/sage/groups/matrix_gps/group_element.pyx +++ b/src/sage/groups/matrix_gps/group_element.pyx @@ -85,7 +85,7 @@ from sage.structure.richcmp cimport richcmp try: - from .group_element_gap import MatrixGroupElement_gap + from sage.groups.matrix_gps.group_element_gap import MatrixGroupElement_gap except ImportError: MatrixGroupElement_gap = () diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index e37c92867a5..0eff4f1eb64 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -20,9 +20,9 @@ from cpython.object cimport Py_EQ, Py_NE, Py_LE, Py_GE, Py_LT, Py_GT from cysignals.signals cimport sig_on, sig_off from sage.libs.gap.gap_includes cimport * -from .libgap import libgap +from sage.libs.gap.libgap import libgap from sage.libs.gap.util cimport * -from .util import GAPError +from sage.libs.gap.util import GAPError from sage.cpython.string cimport str_to_bytes, char_to_str from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx index 1cd182f4f06..e21a74cbef2 100644 --- a/src/sage/libs/gap/util.pyx +++ b/src/sage/libs/gap/util.pyx @@ -241,7 +241,7 @@ cdef initialize(): argv[11] = s1 argv[4] = s1 - from .saved_workspace import workspace + from sage.libs.gap.saved_workspace import workspace workspace, workspace_is_up_to_date = workspace() ws = str_to_bytes(workspace, FS_ENCODING, "surrogateescape") if workspace_is_up_to_date: diff --git a/src/sage/libs/mpmath/ext_libmp.pyx b/src/sage/libs/mpmath/ext_libmp.pyx index 57d119523fb..2f67021b1e1 100644 --- a/src/sage/libs/mpmath/ext_libmp.pyx +++ b/src/sage/libs/mpmath/ext_libmp.pyx @@ -6,7 +6,7 @@ from sage.libs.mpmath.ext_impl cimport * from sage.libs.gmp.all cimport * # the next line is used by mpmath -from .ext_impl import exp_fixed, cos_sin_fixed, log_int_fixed +from sage.libs.mpmath.ext_impl import exp_fixed, cos_sin_fixed, log_int_fixed # Note: not thread-safe cdef MPF tmp1 diff --git a/src/sage/libs/ntl/ntl_GF2E.pyx b/src/sage/libs/ntl/ntl_GF2E.pyx index 0486595b64f..f4a1627bec0 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_GF2E.pyx @@ -32,7 +32,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ from sage.libs.ntl.ntl_GF2 cimport ntl_GF2 from sage.libs.ntl.ntl_GF2X cimport ntl_GF2X from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class -from .ntl_GF2EContext import ntl_GF2EContext +from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext from sage.libs.ntl.ntl_ZZ import unpickle_class_args from sage.misc.randstate cimport current_randstate diff --git a/src/sage/libs/ntl/ntl_GF2EX.pyx b/src/sage/libs/ntl/ntl_GF2EX.pyx index b9705def468..547bc406e1c 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pyx +++ b/src/sage/libs/ntl/ntl_GF2EX.pyx @@ -28,8 +28,8 @@ include 'misc.pxi' include 'decl.pxi' from cpython.object cimport Py_EQ, Py_NE -from .ntl_ZZ import unpickle_class_args -from .ntl_GF2EContext import ntl_GF2EContext +from sage.libs.ntl.ntl_ZZ import unpickle_class_args +from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class from sage.libs.ntl.ntl_GF2E cimport ntl_GF2E diff --git a/src/sage/libs/ntl/ntl_GF2X.pyx b/src/sage/libs/ntl/ntl_GF2X.pyx index fab3e4ebb40..737ddf08d5a 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pyx +++ b/src/sage/libs/ntl/ntl_GF2X.pyx @@ -30,7 +30,7 @@ include 'decl.pxi' from cpython.object cimport Py_EQ, Py_NE from sage.rings.integer cimport Integer -from .ntl_ZZ import unpickle_class_value +from sage.libs.ntl.ntl_ZZ import unpickle_class_value from sage.libs.ntl.ntl_GF2 cimport ntl_GF2 diff --git a/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx b/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx index 3cce29fb52b..1c6ec01c759 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx @@ -149,7 +149,7 @@ cdef class ntl_ZZ_pEContext_class(): sage: c.ZZ_pE([4,3]) [4 3] """ - from .ntl_ZZ_pE import ntl_ZZ_pE + from sage.libs.ntl.ntl_ZZ_pE import ntl_ZZ_pE return ntl_ZZ_pE(v,modulus=self) def ZZ_pEX(self, v = None): @@ -162,7 +162,7 @@ cdef class ntl_ZZ_pEContext_class(): sage: c.ZZ_pEX([4,3]) [[4] [3]] """ - from .ntl_ZZ_pEX import ntl_ZZ_pEX + from sage.libs.ntl.ntl_ZZ_pEX import ntl_ZZ_pEX return ntl_ZZ_pEX(v, modulus=self) cpdef void _assert_is_current_modulus(self) except *: diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pyx b/src/sage/libs/ntl/ntl_mat_GF2E.pyx index 62d3877f272..67875771ea5 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pyx @@ -39,7 +39,7 @@ include 'decl.pxi' from cpython.object cimport Py_EQ, Py_NE from sage.libs.ntl.ntl_GF2E cimport ntl_GF2E -from .ntl_GF2EContext import ntl_GF2EContext +from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class from sage.rings.integer cimport Integer from sage.misc.randstate cimport randstate, current_randstate diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pyx b/src/sage/libs/ntl/ntl_mat_ZZ.pyx index ab106043398..89968c7e46f 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pyx @@ -31,7 +31,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ from sage.libs.ntl.ntl_ZZX cimport ntl_ZZX from cpython.object cimport PyObject_RichCompare -from .ntl_ZZ import unpickle_class_args +from sage.libs.ntl.ntl_ZZ import unpickle_class_args cdef inline ntl_ZZ make_ZZ(ZZ_c* x): cdef ntl_ZZ y diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx index 466d421deaf..5f2805c120f 100644 --- a/src/sage/libs/pari/convert_sage.pyx +++ b/src/sage/libs/pari/convert_sage.pyx @@ -319,7 +319,7 @@ cpdef gen_to_sage(Gen z, locals=None): elif t == t_VECSMALL: return z.python_list_small() elif t == t_MAT: - from .convert_sage_matrix import gen_to_sage_matrix + from sage.libs.pari.convert_sage_matrix import gen_to_sage_matrix return gen_to_sage_matrix(z, locals) elif t == t_PADIC: p = z.padicprime() diff --git a/src/sage/matrix/action.pyx b/src/sage/matrix/action.pyx index 984a9626607..bd0fd9458f0 100644 --- a/src/sage/matrix/action.pyx +++ b/src/sage/matrix/action.pyx @@ -67,7 +67,7 @@ AUTHOR: import operator -from .matrix_space import MatrixSpace, is_MatrixSpace +from sage.matrix.matrix_space import MatrixSpace, is_MatrixSpace from sage.modules.free_module import FreeModule, is_FreeModule from sage.structure.coerce cimport coercion_model from sage.categories.homset import Hom, End diff --git a/src/sage/matrix/args.pyx b/src/sage/matrix/args.pyx index 4d8bfa0984a..517cfbfd228 100644 --- a/src/sage/matrix/args.pyx +++ b/src/sage/matrix/args.pyx @@ -1014,7 +1014,7 @@ cdef class MatrixArgs: if self.space is None: global MatrixSpace if MatrixSpace is None: - from .matrix_space import MatrixSpace + from sage.matrix.matrix_space import MatrixSpace self.space = MatrixSpace(self.base, self.nrows, self.ncols, sparse=self.sparse, **self.kwds) @@ -1147,7 +1147,7 @@ cdef class MatrixArgs: if not (e.flags.c_contiguous is True or e.flags.f_contiguous is True): raise TypeError('numpy matrix must be either c_contiguous or f_contiguous') - from .constructor import matrix + from sage.matrix.constructor import matrix from sage.rings.real_double import RDF from sage.rings.complex_double import CDF diff --git a/src/sage/matrix/change_ring.pyx b/src/sage/matrix/change_ring.pyx index 53e840b4663..f942b753275 100644 --- a/src/sage/matrix/change_ring.pyx +++ b/src/sage/matrix/change_ring.pyx @@ -2,7 +2,7 @@ Functions for changing the base ring of matrices quickly """ -from .matrix_space import MatrixSpace +from sage.matrix.matrix_space import MatrixSpace from sage.matrix.matrix_real_double_dense cimport Matrix_real_double_dense from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense diff --git a/src/sage/matrix/constructor.pyx b/src/sage/matrix/constructor.pyx index 82151080421..418e7f74909 100644 --- a/src/sage/matrix/constructor.pyx +++ b/src/sage/matrix/constructor.pyx @@ -655,7 +655,7 @@ def matrix(*args, **kwds): Matrix = matrix -from .special import * +from sage.matrix.special import * @matrix_method diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx index 1454b782c8c..d3c4232659a 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -48,7 +48,7 @@ from sage.rings.integer_ring import is_IntegerRing import sage.modules.free_module -from .matrix_misc import row_iterator +from sage.matrix.matrix_misc import row_iterator _Fields = Fields() _IntegralDomains = IntegralDomains() @@ -1753,7 +1753,7 @@ cdef class Matrix(sage.structure.element.Matrix): 100 x 100 dense matrix over Integer Ring] """ - from .constructor import options + from sage.matrix.constructor import options if self._nrows <= options.max_rows() and self._ncols <= options.max_cols(): return self.str() if self.is_sparse(): @@ -2054,7 +2054,7 @@ cdef class Matrix(sage.structure.element.Matrix): # only use floating point formatting for inexact types that have # custom implementation of __format__ - from .constructor import options + from sage.matrix.constructor import options prec = options.precision() if prec is None or callable(rep_mapping) or not entries \ or type(entries[0]).__format__ is Element.__format__ \ @@ -2138,7 +2138,7 @@ cdef class Matrix(sage.structure.element.Matrix): -0.35104242112828943 0.5084492941557279] -0.9541798283979341 -0.8948790563276592] """ - from .constructor import options + from sage.matrix.constructor import options if self._nrows <= options.max_rows() and self._ncols <= options.max_cols(): return self.str(character_art=True) else: @@ -2167,7 +2167,7 @@ cdef class Matrix(sage.structure.element.Matrix): sage: unicode_art(A) 100 x 100 dense matrix over Integer Ring """ - from .constructor import options + from sage.matrix.constructor import options if self._nrows <= options.max_rows() and self._ncols <= options.max_cols(): return self.str(unicode=True, character_art=True) else: @@ -2379,7 +2379,7 @@ cdef class Matrix(sage.structure.element.Matrix): [ 5 25] [125 625] """ - from .constructor import matrix + from sage.matrix.constructor import matrix return matrix(self.nrows(), self.ncols(), [e(*args, **kwargs) for e in self.list()]) ################################################### @@ -3855,7 +3855,7 @@ cdef class Matrix(sage.structure.element.Matrix): raise ValueError("length of v must be at most the number of rows of self") if not self._nrows: return self.parent().row_space().zero_vector() - from .constructor import matrix + from sage.matrix.constructor import matrix v = matrix(list(v)+[0]*(self._nrows-len(v))) return (v * self)[0] @@ -3932,7 +3932,7 @@ cdef class Matrix(sage.structure.element.Matrix): raise ValueError("length of v must be at most the number of columns of self") if not self._ncols: return self.parent().column_space().zero_vector() - from .constructor import matrix + from sage.matrix.constructor import matrix v = matrix(self._ncols, 1, list(v)+[0]*(self._ncols-len(v))) return (self * v).column(0) @@ -6182,7 +6182,7 @@ def set_max_rows(n): """ from sage.misc.superseded import deprecation deprecation(30552, "'set_max_rows' is replaced by 'matrix.options.max_rows'") - from .constructor import options + from sage.matrix.constructor import options options.max_rows = n-1 def set_max_cols(n): @@ -6199,5 +6199,5 @@ def set_max_cols(n): """ from sage.misc.superseded import deprecation deprecation(30552, "'set_max_cols' is replaced by 'matrix.options.max_cols'") - from .constructor import options + from sage.matrix.constructor import options options.max_cols = n-1 diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 888669b1f5f..68658914f36 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -99,7 +99,7 @@ from sage.arith.numerical_approx cimport digits_to_bits from copy import copy import sage.modules.free_module -from . import berlekamp_massey +from sage.matrix import berlekamp_massey from sage.modules.free_module_element import is_FreeModuleElement from sage.matrix.matrix_misc import permanental_minor_polynomial @@ -8844,7 +8844,7 @@ cdef class Matrix(Matrix1): output_window = output.matrix_window() - from . import strassen + from sage.matrix import strassen strassen.strassen_window_multiply(output_window, self_window, right_window, cutoff) return output @@ -8882,7 +8882,7 @@ cdef class Matrix(Matrix1): self._echelon_in_place_classical() return - from . import strassen + from sage.matrix import strassen pivots = strassen.strassen_echelon(self.matrix_window(), cutoff) self.cache('pivots', pivots) verbose('done with strassen', tm) @@ -8921,7 +8921,7 @@ cdef class Matrix(Matrix1): ... IndexError: matrix window index out of range """ - from . import matrix_window + from sage.matrix import matrix_window if nrows == -1: nrows = self._nrows - row if ncols == -1: @@ -15120,7 +15120,7 @@ cdef class Matrix(Matrix1): except (OverflowError, TypeError): from sage.rings.real_mpfr import RealField # Try using MPFR, which handles large numbers much better, but is slower. - from .misc_mpfr import hadamard_row_bound_mpfr + from sage.matrix.misc_mpfr import hadamard_row_bound_mpfr R = RealField(53, rnd='RNDU') A = self.change_ring(R) m1 = hadamard_row_bound_mpfr(A) diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index ed0b0f5f5d1..9fce55aa9bb 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -57,13 +57,13 @@ from sage.libs.flint.fmpq cimport fmpq_is_zero, fmpq_set_mpq, fmpq_canonicalise from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry_num, fmpq_mat_entry_den, fmpq_mat_entry from sage.matrix.args cimport MatrixArgs_init -from .constructor import matrix -from .matrix_space import MatrixSpace +from sage.matrix.constructor import matrix +from sage.matrix.matrix_space import MatrixSpace from sage.matrix.matrix cimport Matrix -from . import matrix_dense +from sage.matrix import matrix_dense from sage.matrix.matrix_integer_dense cimport _lift_crt from sage.structure.element cimport Matrix as baseMatrix -from .misc_flint import matrix_integer_dense_rational_reconstruction +from sage.matrix.misc_flint import matrix_integer_dense_rational_reconstruction from sage.arith.misc import binomial, previous_prime from sage.rings.rational_field import QQ @@ -1537,7 +1537,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): K = self.base_ring() phi = K.defining_polynomial() from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF - from .constructor import matrix + from sage.matrix.constructor import matrix F = GF(p) aa = [a for a, _ in phi.change_ring(F).roots()] n = K.degree() diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index ab392cf11a3..c19a2699e88 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -71,7 +71,7 @@ import sage.rings.real_double import sage.rings.complex_double from sage.structure.element cimport Vector -from .constructor import matrix +from sage.matrix.constructor import matrix cimport sage.structure.element cimport numpy as cnumpy diff --git a/src/sage/matrix/matrix_generic_dense.pyx b/src/sage/matrix/matrix_generic_dense.pyx index 6761d13ccba..d25917212ec 100644 --- a/src/sage/matrix/matrix_generic_dense.pyx +++ b/src/sage/matrix/matrix_generic_dense.pyx @@ -9,7 +9,7 @@ from cpython.number cimport * from cpython.ref cimport * cimport sage.matrix.matrix_dense as matrix_dense -from . import matrix_dense +from sage.matrix import matrix_dense from sage.matrix.args cimport MatrixArgs_init cimport sage.matrix.matrix as matrix diff --git a/src/sage/matrix/matrix_generic_sparse.pyx b/src/sage/matrix/matrix_generic_sparse.pyx index 4344dd5f22c..6963d183d8e 100644 --- a/src/sage/matrix/matrix_generic_sparse.pyx +++ b/src/sage/matrix/matrix_generic_sparse.pyx @@ -453,7 +453,7 @@ def Matrix_sparse_from_rows(X): if not X: raise ArithmeticError("X must be nonempty") - from . import matrix_space + from sage.matrix import matrix_space entries = {} R = X[0].base_ring() ncols = X[0].degree() diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index b70f7cb520e..17ada640e03 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -119,12 +119,12 @@ from sage.matrix.matrix_modn_dense_float cimport Matrix_modn_dense_template from sage.matrix.matrix_modn_dense_float cimport Matrix_modn_dense_float from sage.matrix.matrix_modn_dense_double cimport Matrix_modn_dense_double -from .matrix_mod2_dense import Matrix_mod2_dense +from sage.matrix.matrix_mod2_dense import Matrix_mod2_dense from sage.matrix.matrix_mod2_dense cimport Matrix_mod2_dense from sage.rings.finite_rings.finite_field_constructor import GF -from .matrix2 import decomp_seq +from sage.matrix.matrix2 import decomp_seq from sage.matrix.matrix cimport Matrix @@ -1598,8 +1598,8 @@ cdef class Matrix_integer_dense(Matrix_dense): return Matrix_mod2_dense(MS, self, True, True) cdef _mod_int_c(self, mod_int p): - from .matrix_modn_dense_float import MAX_MODULUS as MAX_MODULUS_FLOAT - from .matrix_modn_dense_double import MAX_MODULUS as MAX_MODULUS_DOUBLE + from sage.matrix.matrix_modn_dense_float import MAX_MODULUS as MAX_MODULUS_FLOAT + from sage.matrix.matrix_modn_dense_double import MAX_MODULUS as MAX_MODULUS_DOUBLE cdef Py_ssize_t i, j cdef mpz_t* self_row @@ -1633,8 +1633,8 @@ cdef class Matrix_integer_dense(Matrix_dense): raise ValueError("p to big.") def _reduce(self, moduli): - from .matrix_modn_dense_float import MAX_MODULUS as MAX_MODULUS_FLOAT - from .matrix_modn_dense_double import MAX_MODULUS as MAX_MODULUS_DOUBLE + from sage.matrix.matrix_modn_dense_float import MAX_MODULUS as MAX_MODULUS_FLOAT + from sage.matrix.matrix_modn_dense_double import MAX_MODULUS as MAX_MODULUS_DOUBLE if isinstance(moduli, (int, Integer)): return self._mod_int(moduli) @@ -2058,7 +2058,7 @@ cdef class Matrix_integer_dense(Matrix_dense): if transformation: U = U[:r] elif algorithm == "padic": - from . import matrix_integer_dense_hnf + from sage.matrix import matrix_integer_dense_hnf if transformation: H_m, U = matrix_integer_dense_hnf.hnf_with_transformation(self, proof=proof) if not include_zero_rows: @@ -2105,7 +2105,7 @@ cdef class Matrix_integer_dense(Matrix_dense): H_m.set_immutable() if pivots is None: - from .matrix_integer_dense_hnf import pivots_of_hnf_matrix + from sage.matrix.matrix_integer_dense_hnf import pivots_of_hnf_matrix pivots = pivots_of_hnf_matrix(H_m) pivots = tuple(pivots) rank = len(pivots) @@ -2243,7 +2243,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sage: S = A.saturation(max_dets=2) """ proof = get_proof_flag(proof, "linear_algebra") - from .matrix_integer_dense_saturation import saturation + from sage.matrix.matrix_integer_dense_saturation import saturation return saturation(self, p=p, proof=proof, max_dets=max_dets) def index_in_saturation(self, proof=None): @@ -2281,7 +2281,7 @@ cdef class Matrix_integer_dense(Matrix_dense): [1 1 1] """ proof = get_proof_flag(proof, "linear_algebra") - from .matrix_integer_dense_saturation import index_in_saturation + from sage.matrix.matrix_integer_dense_saturation import index_in_saturation return index_in_saturation(self, proof=proof) def pivots(self): @@ -3448,7 +3448,7 @@ cdef class Matrix_integer_dense(Matrix_dense): ... ZeroDivisionError: The modulus cannot be zero """ - from .misc_flint import matrix_integer_dense_rational_reconstruction + from sage.matrix.misc_flint import matrix_integer_dense_rational_reconstruction return matrix_integer_dense_rational_reconstruction(self, N) def randomize(self, density=1, x=None, y=None, distribution=None, @@ -3813,7 +3813,7 @@ cdef class Matrix_integer_dense(Matrix_dense): fmpz_clear(e) d = det elif algorithm == 'padic': - from . import matrix_integer_dense_hnf + from sage.matrix import matrix_integer_dense_hnf d = matrix_integer_dense_hnf.det_padic(self, proof=proof, stabilize=stabilize) elif algorithm == 'linbox': if proof: @@ -4280,7 +4280,7 @@ cdef class Matrix_integer_dense(Matrix_dense): # in the non-full rank case. In any case, we do this for now, # since rank is very fast and infinite loops are evil. if check_rank and self.rank() < self.nrows(): - from .matrix2 import NotFullRankError + from sage.matrix.matrix2 import NotFullRankError raise NotFullRankError if not self.is_square(): @@ -4727,7 +4727,7 @@ cdef class Matrix_integer_dense(Matrix_dense): d = Integer(1) return pivots, nonpivots, X, d - from .matrix_modn_dense_double import MAX_MODULUS + from sage.matrix.matrix_modn_dense_double import MAX_MODULUS A = self # Step 1: Compute the rank @@ -4926,7 +4926,7 @@ cdef class Matrix_integer_dense(Matrix_dense): """ cdef Py_ssize_t i, j, piv, n = self._nrows, m = self._ncols - from .constructor import matrix + from sage.matrix.constructor import matrix # 0. Base case if self.nrows() == 0: @@ -5634,7 +5634,7 @@ cdef class Matrix_integer_dense(Matrix_dense): [ 3.0 5.0] """ if ring == RDF: - from .change_ring import integer_to_real_double_dense + from sage.matrix.change_ring import integer_to_real_double_dense return integer_to_real_double_dense(self) else: raise NotImplementedError diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx index 62c2c4f18e9..acdf8ef409e 100644 --- a/src/sage/matrix/matrix_integer_sparse.pyx +++ b/src/sage/matrix/matrix_integer_sparse.pyx @@ -424,7 +424,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): ... ZeroDivisionError: The modulus cannot be zero """ - from .misc import matrix_integer_sparse_rational_reconstruction + from sage.matrix.misc import matrix_integer_sparse_rational_reconstruction return matrix_integer_sparse_rational_reconstruction(self, N) def _right_kernel_matrix(self, **kwds): @@ -1040,7 +1040,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): [0 2] """ if check_rank and self.rank() < self.nrows(): - from .matrix2 import NotFullRankError + from sage.matrix.matrix2 import NotFullRankError raise NotFullRankError if self.base_ring() != B.base_ring(): @@ -1233,7 +1233,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): if self._nrows == 0 or self._ncols == 0: raise ValueError("not implemented for nrows=0 or ncols=0") - from .constructor import matrix + from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector cdef Matrix_integer_dense B diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index 936c0e30869..e83f75f93df 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -939,7 +939,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): [0 2] """ if check_rank and self.rank() < self.nrows(): - from .matrix2 import NotFullRankError + from sage.matrix.matrix2 import NotFullRankError raise NotFullRankError if self.base_ring() != B.base_ring(): @@ -1118,7 +1118,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): if self._nrows == 0 or self._ncols == 0: raise ValueError("not implemented for nrows=0 or ncols=0") - from .constructor import matrix + from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector cdef Matrix_integer_dense B diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 18525e78822..aa75cfcba3b 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -115,7 +115,7 @@ from sage.rings.integer_ring import ZZ, is_IntegerRing import sage.rings.abc from sage.rings.rational_field import QQ -from .matrix2 import decomp_seq +from sage.matrix.matrix2 import decomp_seq from sage.misc.verbose import verbose # ######################################################## @@ -1407,7 +1407,7 @@ cdef class Matrix_rational_dense(Matrix_dense): tm = verbose("computing right kernel matrix over the rationals for %sx%s matrix" % (self.nrows(), self.ncols()),level=1) # _rational_kernel_flint() gets the zero-row case wrong, fix it there if self.nrows()==0: - from .constructor import identity_matrix + from sage.matrix.constructor import identity_matrix K = identity_matrix(QQ, self.ncols()) else: A, _ = self._clear_denom() @@ -1474,7 +1474,7 @@ cdef class Matrix_rational_dense(Matrix_dense): A.subdivide(self.subdivisions()) return A - from .matrix_modn_dense_double import MAX_MODULUS + from sage.matrix.matrix_modn_dense_double import MAX_MODULUS if isinstance(R, sage.rings.abc.IntegerModRing) and R.order() < MAX_MODULUS: b = R.order() A, d = self._clear_denom() @@ -1804,7 +1804,7 @@ cdef class Matrix_rational_dense(Matrix_dense): [ 0 0 1 1 3 0] [ 0 0 0 0 0 1] """ - from .misc import matrix_rational_echelon_form_multimodular + from sage.matrix.misc import matrix_rational_echelon_form_multimodular E, pivots = matrix_rational_echelon_form_multimodular(self, height_guess, proof=proof) self.clear_cache() fmpq_mat_swap(self._matrix, (E)._matrix) diff --git a/src/sage/matrix/matrix_rational_sparse.pyx b/src/sage/matrix/matrix_rational_sparse.pyx index 9009b3a8200..1ccc6469d4e 100644 --- a/src/sage/matrix/matrix_rational_sparse.pyx +++ b/src/sage/matrix/matrix_rational_sparse.pyx @@ -585,7 +585,7 @@ cdef class Matrix_rational_sparse(Matrix_sparse): - height_guess -- integer or None - proof -- boolean (default: True) """ - from .misc import matrix_rational_echelon_form_multimodular + from sage.matrix.misc import matrix_rational_echelon_form_multimodular cdef Matrix E E, pivots = matrix_rational_echelon_form_multimodular(self, height_guess=height_guess, proof=proof) diff --git a/src/sage/matrix/matrix_real_double_dense.pyx b/src/sage/matrix/matrix_real_double_dense.pyx index 10ac6cbd996..a95642f3e69 100644 --- a/src/sage/matrix/matrix_real_double_dense.pyx +++ b/src/sage/matrix/matrix_real_double_dense.pyx @@ -61,7 +61,7 @@ cdef class Matrix_real_double_dense(Matrix_double_dense): sage: m**2 [ 7.0 10.0] [15.0 22.0] - sage: n = m^(-1); n # rel tol 1e-15 + sage: n = m^(-1); n # rel tol 1e-15 # needs scipy [-1.9999999999999996 0.9999999999999998] [ 1.4999999999999998 -0.4999999999999999] diff --git a/src/sage/matrix/matrix_symbolic_dense.pyx b/src/sage/matrix/matrix_symbolic_dense.pyx index 0476224e859..25d92edfb59 100644 --- a/src/sage/matrix/matrix_symbolic_dense.pyx +++ b/src/sage/matrix/matrix_symbolic_dense.pyx @@ -159,7 +159,7 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.factorization import Factorization from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense -from .constructor import matrix +from sage.matrix.constructor import matrix cdef maxima diff --git a/src/sage/matrix/matrix_symbolic_sparse.pyx b/src/sage/matrix/matrix_symbolic_sparse.pyx index d763a0c3d99..c9e5ed9cd2b 100644 --- a/src/sage/matrix/matrix_symbolic_sparse.pyx +++ b/src/sage/matrix/matrix_symbolic_sparse.pyx @@ -167,7 +167,7 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.factorization import Factorization from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse -from .constructor import matrix +from sage.matrix.constructor import matrix cdef maxima diff --git a/src/sage/matroids/basis_exchange_matroid.pyx b/src/sage/matroids/basis_exchange_matroid.pyx index 0439a684320..7dcd6d7f97b 100644 --- a/src/sage/matroids/basis_exchange_matroid.pyx +++ b/src/sage/matroids/basis_exchange_matroid.pyx @@ -2152,7 +2152,7 @@ cdef class BasisExchangeMatroid(Matroid): True """ if not isinstance(other, BasisExchangeMatroid): - from .basis_matroid import BasisMatroid + from sage.matroids.basis_matroid import BasisMatroid ot = BasisMatroid(other) else: ot = other @@ -2218,7 +2218,7 @@ cdef class BasisExchangeMatroid(Matroid): True """ if not isinstance(other, BasisExchangeMatroid): - from .basis_matroid import BasisMatroid + from sage.matroids.basis_matroid import BasisMatroid other = BasisMatroid(other) if self is other: return {e:e for e in self.groundset()} diff --git a/src/sage/matroids/circuit_closures_matroid.pyx b/src/sage/matroids/circuit_closures_matroid.pyx index eb0fd1ff06b..fd4eed7ce2e 100644 --- a/src/sage/matroids/circuit_closures_matroid.pyx +++ b/src/sage/matroids/circuit_closures_matroid.pyx @@ -70,7 +70,7 @@ Methods from sage.structure.richcmp cimport rich_to_bool, richcmp from sage.matroids.matroid cimport Matroid from sage.matroids.set_system cimport SetSystem -from .utilities import setprint_s +from sage.matroids.utilities import setprint_s from cpython.object cimport Py_EQ, Py_NE diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index ba13e60eb49..7ed4732ace2 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -346,7 +346,7 @@ MixedIntegerLinearProgram = LazyImport('sage.numerical.mip', 'MixedIntegerLinear from sage.matroids.lean_matrix cimport BinaryMatrix, TernaryMatrix from sage.matroids.set_system cimport SetSystem -from .utilities import newlabel, sanitize_contractions_deletions, spanning_forest, spanning_stars +from sage.matroids.utilities import newlabel, sanitize_contractions_deletions, spanning_forest, spanning_stars # On some systems, macros "minor()" and "major()" are defined in system header @@ -1113,7 +1113,7 @@ cdef class Matroid(SageObject): {'e', 'f', 'g', 'h'}}, 4: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}}} """ - from . import minor_matroid + from sage.matroids import minor_matroid return minor_matroid.MinorMatroid(self, contractions, deletions) cpdef _has_minor(self, N, bint certificate=False): @@ -1226,7 +1226,7 @@ cdef class Matroid(SageObject): sage: [sorted(C) for C in N.circuits() if len(C) == 3] [[0, 1, 6]] """ - from . import basis_matroid + from sage.matroids import basis_matroid return basis_matroid.BasisMatroid(self)._extension(element, hyperplanes) # ** user-facing methods ** @@ -3585,8 +3585,8 @@ cdef class Matroid(SageObject): sage: M._is_isomorphism(N, morphism) True """ - from . import basis_exchange_matroid - from . import basis_matroid + from sage.matroids import basis_exchange_matroid + from sage.matroids import basis_matroid sf = basis_matroid.BasisMatroid(self) if not isinstance(other, basis_exchange_matroid.BasisExchangeMatroid): ot = basis_matroid.BasisMatroid(other) @@ -3669,7 +3669,7 @@ cdef class Matroid(SageObject): return rich_to_bool(op, 1) # Default implementation: use BasisMatroid - from .basis_matroid import BasisMatroid + from sage.matroids.basis_matroid import BasisMatroid return richcmp(BasisMatroid(left), BasisMatroid(right), op) # Minors and duality @@ -3978,7 +3978,7 @@ cdef class Matroid(SageObject): {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}}' """ - from . import dual_matroid + from sage.matroids import dual_matroid return dual_matroid.DualMatroid(self) cpdef truncation(self): @@ -4474,7 +4474,7 @@ cdef class Matroid(SageObject): sage: len(list(M.linear_subclasses(line_length=5))) 44 """ - from . import extension + from sage.matroids import extension return extension.LinearSubclasses(self, line_length=line_length, subsets=subsets) cpdef extensions(self, element=None, line_length=None, subsets=None): @@ -4533,7 +4533,7 @@ cdef class Matroid(SageObject): 5 """ - from . import extension + from sage.matroids import extension if element is None: element = newlabel(self.groundset()) else: @@ -7742,7 +7742,7 @@ cdef class Matroid(SageObject): sage: G.show() # needs sage.plot sage.rings.finite_rings """ - from . import matroids_plot_helpers + from sage.matroids import matroids_plot_helpers if pos_method == 1 and pos_dict is not None: # check sanity of pos_dict and add it to cached info if sane if matroids_plot_helpers.posdict_is_sane(self, pos_dict): @@ -7851,7 +7851,7 @@ cdef class Matroid(SageObject): raise NotImplementedError # check sanity of pos_dict and add it to cached info if sane if pos_dict is not None: - from . import matroids_plot_helpers + from sage.matroids import matroids_plot_helpers if matroids_plot_helpers.posdict_is_sane(self,pos_dict): self._cached_info = {'plot_positions': pos_dict, 'lineorders': lineorders} return @@ -8035,7 +8035,7 @@ cdef class Matroid(SageObject): Binary matroid of rank 3 on 7 elements, type (3, 0) Ternary matroid of rank 3 on 7 elements, type 0- """ - from . import union_matroid + from sage.matroids import union_matroid if isinstance(matroids, Matroid): matroids = [matroids] else: @@ -8085,7 +8085,7 @@ cdef class Matroid(SageObject): sage: len(N.bases()) 2100 """ - from . import union_matroid + from sage.matroids import union_matroid if isinstance(matroids, Matroid): matroids = [matroids] else: diff --git a/src/sage/matroids/unpickling.pyx b/src/sage/matroids/unpickling.pyx index 89eadd4b59c..3ad16a9bea2 100644 --- a/src/sage/matroids/unpickling.pyx +++ b/src/sage/matroids/unpickling.pyx @@ -29,13 +29,13 @@ AUTHORS: from sage.data_structures.bitset_base cimport * import sage.matroids.matroid import sage.matroids.basis_exchange_matroid -from .minor_matroid import MinorMatroid -from .dual_matroid import DualMatroid +from sage.matroids.minor_matroid import MinorMatroid +from sage.matroids.dual_matroid import DualMatroid from sage.matroids.circuit_closures_matroid cimport CircuitClosuresMatroid from sage.matroids.basis_matroid cimport BasisMatroid from sage.matroids.linear_matroid cimport LinearMatroid, RegularMatroid, BinaryMatroid, TernaryMatroid, QuaternaryMatroid from sage.matroids.lean_matrix cimport GenericMatrix, BinaryMatrix, TernaryMatrix, QuaternaryMatrix, PlusMinusOneMatrix, RationalMatrix -from .graphic_matroid import GraphicMatroid +from sage.matroids.graphic_matroid import GraphicMatroid from sage.rings.rational cimport Rational from sage.libs.gmp.mpq cimport mpq_set diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx index 5ef3f50127f..146ee1b2c94 100644 --- a/src/sage/misc/lazy_import.pyx +++ b/src/sage/misc/lazy_import.pyx @@ -67,7 +67,7 @@ import os import pickle from warnings import warn import inspect -from . import sageinspect +from sage.misc import sageinspect # LazyImport.__repr__ uses try... except FeatureNotPresentError. @@ -1141,7 +1141,7 @@ def save_cache_file(): sage: sage.misc.lazy_import.save_cache_file() """ from sage.misc.temporary_file import atomic_write - from .lazy_import_cache import get_cache_file + from sage.misc.lazy_import_cache import get_cache_file global star_imports if star_imports is None: @@ -1184,7 +1184,7 @@ def get_star_imports(module_name): """ global star_imports if star_imports is None: - from .lazy_import_cache import get_cache_file + from sage.misc.lazy_import_cache import get_cache_file star_imports = {} try: with open(get_cache_file(), "rb") as cache_file: diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx index 884617dd1e2..d38e23fc42a 100644 --- a/src/sage/misc/persist.pyx +++ b/src/sage/misc/persist.pyx @@ -43,7 +43,7 @@ import bz2 comp = zlib comp_other = bz2 -from .sage_unittest import TestSuite +from sage.misc.sage_unittest import TestSuite # We define two global dictionaries `already_pickled` and @@ -1192,7 +1192,7 @@ def db(name): The database directory is ``$HOME/.sage/db``. """ - from .misc import SAGE_DB + from sage.misc.misc import SAGE_DB return load('%s/%s'%(SAGE_DB,name)) @@ -1205,5 +1205,5 @@ def db_save(x, name=None): try: x.db(name) except AttributeError: - from .misc import SAGE_DB + from sage.misc.misc import SAGE_DB save(x, '%s/%s'%(SAGE_DB,name)) diff --git a/src/sage/misc/sage_timeit_class.pyx b/src/sage/misc/sage_timeit_class.pyx index 64a08bfaa05..06afeb391ad 100644 --- a/src/sage/misc/sage_timeit_class.pyx +++ b/src/sage/misc/sage_timeit_class.pyx @@ -7,7 +7,7 @@ The ``timeit`` command This uses the function :func:`~sage.misc.sage_timeit.sage_timeit`. """ -from . import sage_timeit +from sage.misc import sage_timeit class SageTimeit: diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index 0ac5626ee14..0c4b8e4e98d 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -34,7 +34,7 @@ cdef extern from "": float roundf(float x) cimport sage.modular.modsym.p1list as p1list -from . import p1list +from sage.modular.modsym import p1list cdef p1list.export export export = p1list.export() diff --git a/src/sage/modular/pollack_stevens/dist.pyx b/src/sage/modular/pollack_stevens/dist.pyx index eeb93f5f8e7..e3d32b089ef 100644 --- a/src/sage/modular/pollack_stevens/dist.pyx +++ b/src/sage/modular/pollack_stevens/dist.pyx @@ -44,7 +44,7 @@ from sage.rings.infinity import Infinity #from sage.libs.flint.ulong_extras cimport * -from .sigma0 import Sigma0 +from sage.modular.pollack_stevens.sigma0 import Sigma0 cdef long overflow = 1 << (4 * sizeof(long) - 1) cdef long underflow = -overflow diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 6975d90cea0..7d56c7626cb 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -555,11 +555,11 @@ def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False): if isinstance(v, ndarray): if len(v.shape) != 1: raise TypeError("cannot convert %r-dimensional array to a vector" % len(v.shape)) - from .free_module import VectorSpace + from sage.modules.free_module import VectorSpace if (R is None or isinstance(R, RealDoubleField)) and v.dtype.kind == 'f': from sage.rings.real_double import RDF V = VectorSpace(RDF, v.shape[0]) - from .vector_real_double_dense import Vector_real_double_dense + from sage.modules.vector_real_double_dense import Vector_real_double_dense v = Vector_real_double_dense(V, v) if immutable: v.set_immutable() @@ -567,7 +567,7 @@ def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False): if (R is None or isinstance(R, ComplexDoubleField)) and v.dtype.kind == 'c': from sage.rings.complex_double import CDF V = VectorSpace(CDF, v.shape[0]) - from .vector_complex_double_dense import Vector_complex_double_dense + from sage.modules.vector_complex_double_dense import Vector_complex_double_dense v = Vector_complex_double_dense(V, v) if immutable: v.set_immutable() @@ -1832,7 +1832,7 @@ cdef class FreeModuleElement(Vector): # abstract base class values = [] for n in range(slicelength): values.append(self.get_unsafe(start + n*step)) - from .free_module import FreeModule + from sage.modules.free_module import FreeModule M = FreeModule(self.coordinate_ring(), slicelength, sparse=self.is_sparse()) return M(values, coerce=False, copy=False) else: @@ -5094,7 +5094,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): if min <= n <= max and n % step == mod: k = (n - start) // step newentries[k] = x - from .free_module import FreeModule + from sage.modules.free_module import FreeModule M = FreeModule(self.coordinate_ring(), slicelength, sparse=True) return M(newentries, coerce=False, copy=False) diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx index 1b22498c516..03c6862af37 100644 --- a/src/sage/modules/vector_double_dense.pyx +++ b/src/sage/modules/vector_double_dense.pyx @@ -288,7 +288,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): fft = scipy.fft ifft = scipy.ifft V = CDF ** self._degree - from .vector_complex_double_dense import Vector_complex_double_dense + from sage.modules.vector_complex_double_dense import Vector_complex_double_dense if direction == 'forward': return Vector_complex_double_dense(V, fft(self._vector_numpy)) else: diff --git a/src/sage/modules/vector_numpy_dense.pyx b/src/sage/modules/vector_numpy_dense.pyx index d62be9df1e2..0f46493d1fe 100644 --- a/src/sage/modules/vector_numpy_dense.pyx +++ b/src/sage/modules/vector_numpy_dense.pyx @@ -30,7 +30,7 @@ AUTHORS: cimport numpy import numpy -from .free_module_element import FreeModuleElement +from sage.modules.free_module_element import FreeModuleElement # This is for the NumPy C API (the PyArray... functions) to work numpy.import_array() diff --git a/src/sage/plot/plot3d/base.pyx b/src/sage/plot/plot3d/base.pyx index 0633fe5f442..8b45fa1e4ea 100644 --- a/src/sage/plot/plot3d/base.pyx +++ b/src/sage/plot/plot3d/base.pyx @@ -64,7 +64,7 @@ from sage.misc.temporary_file import tmp_filename from sage.misc.fast_methods cimport hash_by_id from sage.modules.free_module_element import vector from sage.rings.real_double import RDF -from .texture import Texture +from sage.plot.plot3d.texture import Texture from sage.plot.plot3d.transform cimport Transformation, point_c, face_c include "point_c.pxi" @@ -503,7 +503,7 @@ cdef class Graphics3d(SageObject): js_options['axesLabelsStyle'] = None if js_options['axesLabelsStyle'] is not None: - from .shapes import _validate_threejs_text_style + from sage.plot.plot3d.shapes import _validate_threejs_text_style style = js_options['axesLabelsStyle'] if isinstance(style, dict): style = _validate_threejs_text_style(style) @@ -1553,7 +1553,7 @@ end_scene""".format( T = [xyz_min[i] - a_min[i] for i in range(3)] X = X.translate(T) if frame: - from .shapes2 import frame3d, frame_labels + from sage.plot.plot3d.shapes2 import frame3d, frame_labels F = frame3d(xyz_min, xyz_max, opacity=0.5, color=(0,0,0), thickness=thickness) if labels: F += frame_labels(xyz_min, xyz_max, a_min_orig, a_max_orig) @@ -1562,7 +1562,7 @@ end_scene""".format( if axes: # draw axes - from .shapes import arrow3d + from sage.plot.plot3d.shapes import arrow3d A = (arrow3d((min(0,a_min[0]),0, 0), (max(0,a_max[0]), 0,0), thickness, color="blue"), arrow3d((0,min(0,a_min[1]), 0), (0, max(0,a_max[1]), 0), diff --git a/src/sage/plot/plot3d/index_face_set.pyx b/src/sage/plot/plot3d/index_face_set.pyx index 88e41e4b9c8..4aa26b3b551 100644 --- a/src/sage/plot/plot3d/index_face_set.pyx +++ b/src/sage/plot/plot3d/index_face_set.pyx @@ -1551,7 +1551,7 @@ cdef class IndexFaceSet(PrimitiveObject): str(self.fcount + extra_faces), faces] - from .base import flatten_list + from sage.plot.plot3d.base import flatten_list name = render_params.unique_name('obj') all = flatten_list(all) if render_params.output_archive: diff --git a/src/sage/plot/plot3d/parametric_surface.pyx b/src/sage/plot/plot3d/parametric_surface.pyx index 5a3556e7025..733e6af0e5e 100644 --- a/src/sage/plot/plot3d/parametric_surface.pyx +++ b/src/sage/plot/plot3d/parametric_surface.pyx @@ -123,7 +123,7 @@ from math import cos, sin from sage.rings.real_double import RDF from sage.plot.colors import check_color_data -from .base import RenderParams +from sage.plot.plot3d.base import RenderParams from sage.plot.plot3d.transform cimport point_c, face_c from sage.ext.interpreters.wrapper_rdf cimport Wrapper_rdf diff --git a/src/sage/plot/plot3d/shapes.pyx b/src/sage/plot/plot3d/shapes.pyx index 9b07dec1775..fed6197b145 100644 --- a/src/sage/plot/plot3d/shapes.pyx +++ b/src/sage/plot/plot3d/shapes.pyx @@ -57,7 +57,7 @@ from libc.math cimport sqrt, sin, cos, acos, M_PI from sage.rings.real_double import RDF from sage.modules.free_module_element import vector from sage.misc.decorators import rename_keyword -from .base import Graphics3dGroup +from sage.plot.plot3d.base import Graphics3dGroup from sage.plot.plot3d.index_face_set cimport IndexFaceSet, PrimitiveObject from sage.plot.plot3d.transform cimport point_c @@ -246,7 +246,7 @@ def ColorCube(size, colors, opacity=1, **kwds): all = [] kwds['opacity'] = opacity - from .texture import Texture + from sage.plot.plot3d.texture import Texture for k in range(6): all.append(IndexFaceSet([faces[k]], enclosed=True, texture=Texture(colors[k], opacity=opacity), @@ -1331,7 +1331,7 @@ def _validate_threejs_text_style(style): """ default_color = '#000000' # black color = style.get('color', default_color) - from .texture import Texture + from sage.plot.plot3d.texture import Texture try: texture = Texture(color=color) except ValueError: diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 0500f0520b0..6c30e71e945 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -109,7 +109,7 @@ complex_double_element_zeta = None from sage.rings.complex_conversion cimport CCtoCDF from sage.rings.real_double cimport RealDoubleElement, double_repr -from .real_double import RDF +from sage.rings.real_double import RDF from sage.rings.integer_ring import ZZ from sage.structure.richcmp cimport rich_to_bool @@ -238,7 +238,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): sage: CDF.characteristic() 0 """ - from .integer import Integer + from sage.rings.integer import Integer return Integer(0) def random_element(self, double xmin=-1, double xmax=1, double ymin=-1, double ymax=1): @@ -376,7 +376,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): sage: CDF((1,2)) # indirect doctest 1.0 + 2.0*I """ - from . import complex_mpfr + from sage.rings import complex_mpfr if isinstance(x, ComplexDoubleElement): return x elif isinstance(x, tuple): @@ -442,10 +442,10 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): """ if S is int or S is float: return FloatToCDF(S) - from .rational_field import QQ - from .real_lazy import RLF - from .real_mpfr import RR - from .cc import CC + from sage.rings.rational_field import QQ + from sage.rings.real_lazy import RLF + from sage.rings.real_mpfr import RR + from sage.rings.cc import CC if S is ZZ or S is QQ or S is RDF or S is RLF: return FloatToCDF(S) @@ -527,7 +527,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): if prec == 53: return self else: - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField(prec) @@ -646,7 +646,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): ... ValueError: n must be a positive integer """ - from .integer import Integer + from sage.rings.integer import Integer try: n = Integer(n) except TypeError: @@ -993,7 +993,7 @@ cdef class ComplexDoubleElement(FieldElement): True """ # Sending to another computer algebra system is slow anyway, right? - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField()(self)._interface_init_(I) def _mathematica_init_(self): @@ -1005,7 +1005,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: mathematica(CDF(1e-25, 1e25)) # optional - mathematica 1.*^-25 + 1.*^25*I """ - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField()(self)._mathematica_init_() def _maxima_init_(self, I=None): @@ -1020,7 +1020,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: CDF(.5 + I)._maxima_init_() # needs sage.symbolic '0.50000000000000000 + 1.0000000000000000*%i' """ - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField()(self)._maxima_init_(I) def _sympy_(self): @@ -1122,7 +1122,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: format(CDF(0, 0), '+#.4') '+0.000' """ - from .complex_mpfr import _format_complex_number + from sage.rings.complex_mpfr import _format_complex_number return _format_complex_number(GSL_REAL(self._complex), GSL_IMAG(self._complex), format_spec) @@ -2407,12 +2407,12 @@ cdef class ComplexDoubleElement(FieldElement): """ if not GSL_IMAG(self._complex): if GSL_REAL(self._complex) == 0: - from .infinity import unsigned_infinity + from sage.rings.infinity import unsigned_infinity return unsigned_infinity try: - from .integer import Integer + from sage.rings.integer import Integer if Integer(GSL_REAL(self._complex)) < 0: - from .cc import CC + from sage.rings.cc import CC return CC(self).gamma() except TypeError: pass @@ -2454,7 +2454,7 @@ cdef class ComplexDoubleElement(FieldElement): Infinity """ if GSL_REAL(self._complex) == 1 and GSL_IMAG(self._complex) == 0: - from .infinity import unsigned_infinity + from sage.rings.infinity import unsigned_infinity return unsigned_infinity global complex_double_element_zeta diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index 0af64503ebe..d3d9893540e 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -72,7 +72,7 @@ from sage.rings.integer cimport Integer cimport sage.rings.real_mpfi as real_mpfi from sage.rings.real_mpfr cimport RealNumber from sage.rings.convert.mpfi cimport mpfi_set_sage -from .infinity import infinity +from sage.rings.infinity import infinity def is_ComplexIntervalFieldElement(x): @@ -1915,7 +1915,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): 0.500000000000000? + 3.39927010637040?*I """ if not self: - from .real_mpfi import RIF + from sage.rings.real_mpfi import RIF return RIF(0).log() re = abs(self).log() im = self.argument() @@ -2292,6 +2292,6 @@ def create_ComplexIntervalFieldElement(s_real, s_imag=None, int pad=0, min_prec= #else: # bits = max(int(math.log(base,2)*len(s_imag)),int(math.log(base,2)*len(s_imag))) - from .complex_interval_field import ComplexIntervalField + from sage.rings.complex_interval_field import ComplexIntervalField C = ComplexIntervalField(prec=max(bits+pad, min_prec)) return ComplexIntervalFieldElement(C, s_real, s_imag) diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index b9c185e0344..f73420e47e4 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -60,7 +60,7 @@ EXAMPLES:: # **************************************************************************** import re -from . import real_mpfr +from sage.rings import real_mpfr import weakref from cpython.object cimport Py_NE @@ -82,11 +82,11 @@ except ImportError: from sage.rings.integer cimport Integer from sage.rings.complex_mpfr cimport ComplexNumber -from .complex_mpfr import ComplexField_class +from sage.rings.complex_mpfr import ComplexField_class from sage.misc.randstate cimport randstate, current_randstate from sage.rings.real_mpfr cimport RealField_class, RealNumber -from .real_mpfr import mpfr_prec_min, mpfr_prec_max +from sage.rings.real_mpfr import mpfr_prec_min, mpfr_prec_max from sage.structure.richcmp cimport rich_to_bool, richcmp from sage.categories.fields import Fields @@ -113,8 +113,8 @@ def late_import(): import sage.rings.qqbar AA = sage.rings.qqbar.AA QQbar = sage.rings.qqbar.QQbar - from .real_lazy import CLF, RLF - from .complex_double import CDF + from sage.rings.real_lazy import CLF, RLF + from sage.rings.complex_double import CDF _mpfr_rounding_modes = ['RNDN', 'RNDZ', 'RNDU', 'RNDD'] diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 5922f4f1f3d..c3672358fca 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -47,7 +47,7 @@ from sage.misc.sage_eval import sage_eval import sage.rings.abc from sage.arith.constants cimport LOG_TEN_TWO_PLUS_EPSILON -from . import infinity +from sage.rings import infinity from sage.rings.integer cimport Integer from sage.rings.complex_double cimport ComplexDoubleElement @@ -90,8 +90,8 @@ def late_import(): from sage.rings.qqbar import AA, QQbar except ImportError: pass - from .real_lazy import CLF, RLF - from .complex_double import CDF + from sage.rings.real_lazy import CLF, RLF + from sage.rings.complex_double import CDF cdef object numpy_complex_interface = {'typestr': '=c16'} cdef object numpy_object_interface = {'typestr': '|O'} @@ -386,7 +386,7 @@ class ComplexField_class(sage.rings.abc.ComplexField): try: return self.__real_field except AttributeError: - from .real_mpfr import RealField + from sage.rings.real_mpfr import RealField self.__real_field = RealField(self._prec) return self.__real_field @@ -2949,7 +2949,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): if base is None: return ComplexNumber(self._parent, rho.log(), theta) else: - from .real_mpfr import RealField + from sage.rings.real_mpfr import RealField return ComplexNumber(self._parent, rho.log()/RealNumber(RealField(self.prec()),base).log(), theta/RealNumber(RealField(self.prec()),base).log()) def additive_order(self): diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 06995ba79f5..0b06ed5d6a2 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -45,8 +45,8 @@ from sage.libs.pari.all import pari from cypari2.gen cimport Gen from cypari2.stack cimport clear_stack -from .element_pari_ffelt import FiniteFieldElement_pari_ffelt -from .finite_field_ntl_gf2e import FiniteField_ntl_gf2e +from sage.rings.finite_rings.element_pari_ffelt import FiniteFieldElement_pari_ffelt +from sage.rings.finite_rings.finite_field_ntl_gf2e import FiniteField_ntl_gf2e from sage.interfaces.abc import GapElement diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index da77fa501a2..27dad2d1101 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -27,7 +27,7 @@ from cypari2.stack cimport new_gen, new_gen_noclear, clear_stack from cypari2.gen cimport Gen as pari_gen, objtogen from sage.rings.finite_rings.element_base cimport FinitePolyExtElement -from .integer_mod import IntegerMod_abstract +from sage.rings.finite_rings.integer_mod import IntegerMod_abstract import sage.rings.integer from sage.rings.integer cimport Integer diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 15c3f6d020c..199dc8c993d 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1045,7 +1045,7 @@ cdef class FiniteField(Field): pass from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing - from .finite_field_constructor import GF + from sage.rings.finite_rings.finite_field_constructor import GF R = PolynomialRing(GF(self.characteristic()), 'x') self._modulus = R((-1,1)) # Polynomial x - 1 return self._modulus @@ -1296,7 +1296,7 @@ cdef class FiniteField(Field): inclusion_map = self.coerce_map_from(base) from sage.matrix.constructor import matrix - from .maps_finite_field import ( + from sage.rings.finite_rings.maps_finite_field import ( MorphismVectorSpaceToFiniteField, MorphismFiniteFieldToVectorSpace) E = self @@ -1387,7 +1387,7 @@ cdef class FiniteField(Field): if isinstance(R, FiniteField): if R is self: return True - from .residue_field import ResidueField_generic + from sage.rings.finite_rings.residue_field import ResidueField_generic if isinstance(R, ResidueField_generic): return False if R.characteristic() == self.characteristic(): @@ -1551,7 +1551,7 @@ cdef class FiniteField(Field): sage: L(u).minpoly() == u.minpoly() True """ - from .finite_field_constructor import GF + from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.integer import Integer if name is None and names is not None: @@ -1727,7 +1727,7 @@ cdef class FiniteField(Field): sage: GF(3^8, 'a').subfield(4) Finite Field in a4 of size 3^4 """ - from .finite_field_constructor import GF + from sage.rings.finite_rings.finite_field_constructor import GF p = self.characteristic() n = self.degree() if not n % degree == 0: @@ -1934,7 +1934,7 @@ cdef class FiniteField(Field): sage: GF(next_prime(2^16, 2), 'a').is_conway() False """ - from .conway_polynomials import conway_polynomial, exists_conway_polynomial + from sage.rings.finite_rings.conway_polynomials import conway_polynomial, exists_conway_polynomial p = self.characteristic() n = self.degree() return (exists_conway_polynomial(p, n) diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index 0ca709d08d3..26a7b7521ee 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -764,7 +764,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): """ if self._degree_fixed == 1: k = FiniteField(self.domain().characteristic()) - from .hom_prime_finite_field import FiniteFieldHomomorphism_prime + from sage.rings.finite_rings.hom_prime_finite_field import FiniteFieldHomomorphism_prime f = FiniteFieldHomomorphism_prime(Hom(k, self.domain())) else: k = FiniteField(self.domain().characteristic()**self._degree_fixed, diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 88d8e8302ee..6c2e2f6c071 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -154,7 +154,7 @@ def Mod(n, m, parent=None): # m is non-zero, so return n mod m if parent is None: - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing parent = IntegerModRing(m) return IntegerMod(parent, n) @@ -494,7 +494,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): if not isinstance(self, IntegerMod_abstract): # something % Mod(x,y) makes no sense return NotImplemented - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing R = IntegerModRing(modulus) if (self)._parent._IntegerModRing_generic__order % R.order(): raise ArithmeticError(f"reduction modulo {modulus!r} not defined") @@ -1230,7 +1230,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): R = self.parent()['x'] modulus = R.gen()**2 - R(self) if self._parent.is_field(): - from .finite_field_constructor import FiniteField + from sage.rings.finite_rings.finite_field_constructor import FiniteField Q = FiniteField(self._modulus.sageInteger**2, y, modulus) else: R = self.parent()['x'] @@ -1440,7 +1440,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): ....: if (y^41).nth_root(41*r)**(41*r) != y^41: raise RuntimeError ....: if (y^307).nth_root(307*r)**(307*r) != y^307: raise RuntimeError - sage: for t in range(200): # needs sage.libs.pari + sage: for t in range(200): # needs sage.libs.pari sage.rings.padics ....: n = randint(1,2^63) ....: K = Integers(n) ....: b = K.random_element() @@ -2140,7 +2140,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): modulus = self._modulus.sageInteger other_modulus = other._modulus.sageInteger - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing lift = IntegerMod_gmp(IntegerModRing(modulus*other_modulus)) try: if mpz_cmp(self.value, other.value) > 0: @@ -2544,7 +2544,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): cdef IntegerMod_int lift cdef int_fast32_t x - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing lift = IntegerMod_int(IntegerModRing(self._modulus.int32 * other._modulus.int32)) try: @@ -3380,7 +3380,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): cdef IntegerMod_int64 lift cdef int_fast64_t x - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing lift = IntegerMod_int64(IntegerModRing(self._modulus.int64 * other._modulus.int64)) try: diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx index d8092731b1f..cf8320f19bf 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -387,7 +387,7 @@ class ResidueFieldFactory(UniqueFactory): q = characteristic**(f.degree()) if q < zech_log_bound and (impl is None or impl == 'givaro'): try: - from .residue_field_givaro import ResidueFiniteField_givaro + from sage.rings.finite_rings.residue_field_givaro import ResidueFiniteField_givaro except ImportError: if impl is not None: raise @@ -395,7 +395,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_givaro(p, q, names, f, None, None, None) if q % 2 == 0 and (impl is None or impl == 'ntl'): try: - from .residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e + from sage.rings.finite_rings.residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e except ImportError: if impl is not None: raise @@ -403,7 +403,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_ntl_gf2e(q, names, f, "poly", p, None, None, None) if impl is None or impl == 'pari': try: - from .residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt + from sage.rings.finite_rings.residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt except ImportError: if impl is not None: raise @@ -463,7 +463,7 @@ class ResidueFieldFactory(UniqueFactory): q = characteristic**(f.degree()) if q < zech_log_bound and (impl is None or impl == 'givaro'): try: - from .residue_field_givaro import ResidueFiniteField_givaro + from sage.rings.finite_rings.residue_field_givaro import ResidueFiniteField_givaro except ImportError: if impl is not None: raise @@ -471,7 +471,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_givaro(p, q, names, f, to_vs, to_order, PB) elif q % 2 == 0 and (impl is None or impl == 'ntl'): try: - from .residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e + from sage.rings.finite_rings.residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e except ImportError: if impl is not None: raise @@ -479,7 +479,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_ntl_gf2e(q, names, f, "poly", p, to_vs, to_order, PB) if impl is None or impl == 'pari': try: - from .residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt + from sage.rings.finite_rings.residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt except ImportError: if impl is not None: raise diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 4e668a00ac0..64be9353793 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -23,7 +23,7 @@ AUTHORS: from sage.structure.element cimport FieldElement, parent from sage.structure.richcmp cimport richcmp -from .rational_field import QQ +from sage.rings.rational_field import QQ import sage.misc.latex as latex diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index ae23de6b4bf..66c5d775f13 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -84,7 +84,7 @@ def is_FunctionFieldElement(x): """ if isinstance(x, FunctionFieldElement): return True - from .function_field import is_FunctionField + from sage.rings.function_field.function_field import is_FunctionField return is_FunctionField(x.parent()) def make_FunctionFieldElement(parent, element_class, representing_element): diff --git a/src/sage/rings/function_field/element_polymod.pyx b/src/sage/rings/function_field/element_polymod.pyx index c59d876a6a5..5cc4895c997 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -385,7 +385,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): if deg == 1: return self._parent(self._x[0].nth_root(self._parent.characteristic())) - from .function_field_rational import RationalFunctionField + from sage.rings.function_field.function_field_rational import RationalFunctionField if not isinstance(self.base_ring(), RationalFunctionField): raise NotImplementedError("only implemented for simple extensions of function fields") # compute a representation of the generator y of the field in terms of powers of y^p diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index b8e5b880b1c..58d9592ca11 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -304,7 +304,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: (1/x^2).valuation(p) # needs sage.libs.pari -2 """ - from .place import FunctionFieldPlace + from sage.rings.function_field.place import FunctionFieldPlace if not isinstance(place, FunctionFieldPlace): # place is an irreducible polynomial diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 6f570e384bb..f2e5ee1a190 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -184,7 +184,7 @@ from sage.structure.element import coerce_binop from sage.structure.richcmp cimport rich_to_bool_sgn -from . import integer_ring +from sage.rings import integer_ring cimport gmpy2 gmpy2.import_gmpy2() @@ -2536,7 +2536,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): cdef int pow_2 cdef size_t upper,lower,middle - from .real_mpfi import RIF as R + from sage.rings.real_mpfi import RIF as R rif_self = R(self) @@ -2723,7 +2723,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): # (suggested by David Harvey and Carl Witty) # "for randomly distributed integers, the chance of this # interval-based comparison failing is absurdly low" - from .real_mpfi import RIF + from sage.rings.real_mpfi import RIF approx_compare = RIF(m)**guess if self > approx_compare: guess_filled = 1 diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index 9f062b67b82..fd7bc600ab7 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -68,7 +68,7 @@ from sage.misc.randstate cimport randstate, current_randstate, SAGE_RAND_MAX cimport sage.rings.integer as integer -from . import ring +from sage.rings import ring arith = None cdef void late_import(): diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 9d02842e85a..c6c769ddd9c 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -67,7 +67,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from .infinity import infinity +from sage.rings.infinity import infinity from sage.rings.rational_field import QQ import sage.misc.latex diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 657911a5e32..2483e667893 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -407,7 +407,7 @@ compare equal:: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import ideal +from sage.rings import ideal import sage.structure.all from sage.structure.richcmp cimport (richcmp, rich_to_bool) from sage.misc.cachefunc import cached_method @@ -674,7 +674,7 @@ cdef class RingHomomorphism(RingMap): True """ - from .homset import RingHomset_generic + from sage.rings.homset import RingHomset_generic if not isinstance(parent, RingHomset_generic): raise TypeError("parent must be a ring homset") RingMap.__init__(self, parent) @@ -1066,10 +1066,10 @@ cdef class RingHomomorphism(RingMap): sage: f.kernel() # needs sage.libs.singular Ideal (0) of Multivariate Polynomial Ring in t, u over Rational Field """ - from .polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing - from .quotient_ring import is_QuotientRing - from .polynomial.multi_polynomial_ring import is_MPolynomialRing - from .polynomial.polynomial_ring import is_PolynomialRing + from sage.rings.polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing + from sage.rings.quotient_ring import is_QuotientRing + from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing + from sage.rings.polynomial.polynomial_ring import is_PolynomialRing B = self.codomain() graph, from_B, to_A = self._graph_ideal() Q = graph.ring() @@ -1315,8 +1315,8 @@ cdef class RingHomomorphism(RingMap): ... NotImplementedError: rings are not commutative """ - from .quotient_ring import is_QuotientRing - from .ideal import Ideal_generic + from sage.rings.quotient_ring import is_QuotientRing + from sage.rings.ideal import Ideal_generic A = self.domain() B = self.codomain() if not (A.is_commutative() and B.is_commutative()): @@ -3023,7 +3023,7 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): Frobenius endomorphism x |--> x^(5^2) of Power Series Ring in u over Finite Field of size 5 """ - from .ring import CommutativeRing + from sage.rings.ring import CommutativeRing from sage.categories.homset import Hom if not isinstance(domain, CommutativeRing): raise TypeError("The base ring must be a commutative ring") @@ -3276,14 +3276,14 @@ def _tensor_product_ring(B, A): ... ValueError: term ordering must be global """ - from .finite_rings.finite_field_base import FiniteField - from .number_field.number_field_base import NumberField - from .polynomial.multi_polynomial_ring import is_MPolynomialRing - from .polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing - from .polynomial.polynomial_ring import is_PolynomialRing - from .polynomial.polynomial_ring_constructor import PolynomialRing - from .polynomial.term_order import TermOrder - from .quotient_ring import is_QuotientRing + from sage.rings.finite_rings.finite_field_base import FiniteField + from sage.rings.number_field.number_field_base import NumberField + from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing + from sage.rings.polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing + from sage.rings.polynomial.polynomial_ring import is_PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.term_order import TermOrder + from sage.rings.quotient_ring import is_QuotientRing if set(B.variable_names()).isdisjoint(A.variable_names()): names = B.variable_names() + A.variable_names() diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index ea70ce6552d..392f35f898a 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -393,7 +393,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): quadratic field elements) """ if check: - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if not isinstance(self.number_field(), NumberField_cyclotomic) \ or not isinstance(new_parent, NumberField_cyclotomic): raise TypeError("The field and the new parent field must both be cyclotomic fields.") @@ -563,7 +563,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): return str(self) p = self.polynomial() P = self.parent() - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if isinstance(P, NumberField_cyclotomic): n = P._n() if n != 2 and n%4 == 2: @@ -603,7 +603,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): ....: t = K.random_element() ....: assert K(libgap(t)) == t, "n = {} t = {}".format(n,t) """ - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic P = self.parent() if not isinstance(P, NumberField_cyclotomic): raise NotImplementedError("libgap conversion is only implemented for cyclotomic fields") @@ -2032,7 +2032,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): raise ArithmeticError("factorization of 0 is not defined") K = self.parent() - from .order import is_NumberFieldOrder + from sage.rings.number_field.order import is_NumberFieldOrder if is_NumberFieldOrder(K): K = K.number_field() fac = K.ideal(self).factor() @@ -2138,7 +2138,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): if R.is_field(): return R.one() - from .order import is_NumberFieldOrder + from sage.rings.number_field.order import is_NumberFieldOrder if not is_NumberFieldOrder(R) or not R.is_maximal(): raise NotImplementedError("gcd() for %r is not implemented" % R) @@ -2930,7 +2930,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): raise ValueError("need a real or complex embedding to convert " "a non rational element of a number field " "into an algebraic number") - from .number_field import refine_embedding + from sage.rings.number_field.number_field import refine_embedding emb = refine_embedding(emb, infinity) return parent(emb(self)) @@ -3043,7 +3043,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): if embedding is None: raise TypeError("an embedding into RR or CC must be specified") - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if isinstance(K, NumberField_cyclotomic): # solution by radicals may be difficult, but we have a closed form from sage.functions.log import exp @@ -3056,7 +3056,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): gen_image = exp(k*two_pi_i/K._n()) return self.polynomial()(gen_image) else: - from .number_field import refine_embedding + from sage.rings.number_field.number_field import refine_embedding # Convert the embedding to an embedding into AA or QQbar embedding = refine_embedding(embedding, infinity) a = embedding(self).radical_expression() @@ -3410,7 +3410,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): True """ if self.__multiplicative_order is None: - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if self.is_rational(): if self.is_one(): self.__multiplicative_order = ZZ.one() @@ -3969,7 +3969,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): ... ValueError: P must be prime """ - from .number_field_ideal import is_NumberFieldIdeal + from sage.rings.number_field.number_field_ideal import is_NumberFieldIdeal if not is_NumberFieldIdeal(P): if isinstance(P, NumberFieldElement): P = self.number_field().fractional_ideal(P) diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pyx b/src/sage/rings/number_field/number_field_element_quadratic.pyx index 7640e7e91f4..e853e2ec4eb 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pyx +++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx @@ -521,7 +521,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): - Craig Citro (reworked for quadratic elements) """ if check: - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if not isinstance(self.number_field(), NumberField_cyclotomic) \ or not isinstance(new_parent, NumberField_cyclotomic): raise TypeError("The field and the new parent field must both be cyclotomic fields.") @@ -1919,10 +1919,10 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): else: # avoid circular import if self._parent._embedding is None: - from .number_field import NumberField + from sage.rings.number_field.number_field import NumberField K = NumberField(QQ['x'].gen()**2 - negD, 'sqrt%s' % negD) else: - from .number_field import QuadraticField + from sage.rings.number_field.number_field import QuadraticField K = QuadraticField(negD, 'sqrt%s' % negD) q = ( K._zero_element)._new() mpz_set(q.denom, self.denom) diff --git a/src/sage/rings/number_field/number_field_morphisms.pyx b/src/sage/rings/number_field/number_field_morphisms.pyx index 835dbff4768..203d80e42fd 100644 --- a/src/sage/rings/number_field/number_field_morphisms.pyx +++ b/src/sage/rings/number_field/number_field_morphisms.pyx @@ -619,7 +619,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): -1 """ Morphism.__init__(self, K, L) - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if not isinstance(K, NumberField_cyclotomic) or not isinstance(L, NumberField_cyclotomic): raise TypeError("CyclotomicFieldEmbedding only valid for cyclotomic fields.") Kn = K._n() diff --git a/src/sage/rings/number_field/totallyreal_data.pyx b/src/sage/rings/number_field/totallyreal_data.pyx index a8a09c8eae7..f14c541b6c0 100644 --- a/src/sage/rings/number_field/totallyreal_data.pyx +++ b/src/sage/rings/number_field/totallyreal_data.pyx @@ -443,7 +443,7 @@ def easy_is_irreducible_py(f): cdef double eps_global eps_global = 10.**(-4) -from .totallyreal_phc import __lagrange_bounds_phc +from sage.rings.number_field.totallyreal_phc import __lagrange_bounds_phc cdef class tr_data: r""" diff --git a/src/sage/rings/padics/morphism.pyx b/src/sage/rings/padics/morphism.pyx index 73ae1d53471..d69331dca94 100644 --- a/src/sage/rings/padics/morphism.pyx +++ b/src/sage/rings/padics/morphism.pyx @@ -20,7 +20,7 @@ from sage.structure.richcmp cimport (richcmp, rich_to_bool, richcmp_not_equal) from sage.rings.morphism cimport RingHomomorphism -from .padic_generic import pAdicGeneric +from sage.rings.padics.padic_generic import pAdicGeneric cdef class FrobeniusEndomorphism_padics(RingHomomorphism): diff --git a/src/sage/rings/padics/padic_printing.pyx b/src/sage/rings/padics/padic_printing.pyx index 344a1e544a7..dfe597ac931 100644 --- a/src/sage/rings/padics/padic_printing.pyx +++ b/src/sage/rings/padics/padic_printing.pyx @@ -464,7 +464,7 @@ cdef class pAdicPrinter_class(SageObject): raise ValueError("max_terse_terms must be positive and fit in a long") else: self.max_terse_terms = _printer_defaults._max_terse_terms - from .factory import _canonicalize_show_prec + from sage.rings.padics.factory import _canonicalize_show_prec self.show_prec = _canonicalize_show_prec(self.ring._prec_type(), mode, show_prec) # Incompatibilities diff --git a/src/sage/rings/padics/pow_computer.pyx b/src/sage/rings/padics/pow_computer.pyx index 1c5bdf86897..8cca60f514b 100644 --- a/src/sage/rings/padics/pow_computer.pyx +++ b/src/sage/rings/padics/pow_computer.pyx @@ -621,13 +621,13 @@ cdef PowComputer_base PowComputer_c(Integer m, Integer cache_limit, Integer prec if PC is not None: return PC if prec_type == 'capped-rel': - from .padic_capped_relative_element import PowComputer_ as PC_class + from sage.rings.padics.padic_capped_relative_element import PowComputer_ as PC_class elif prec_type == 'capped-abs': - from .padic_capped_absolute_element import PowComputer_ as PC_class + from sage.rings.padics.padic_capped_absolute_element import PowComputer_ as PC_class elif prec_type == 'fixed-mod': - from .padic_fixed_mod_element import PowComputer_ as PC_class + from sage.rings.padics.padic_fixed_mod_element import PowComputer_ as PC_class elif prec_type == 'floating-point': - from .padic_floating_point_element import PowComputer_ as PC_class + from sage.rings.padics.padic_floating_point_element import PowComputer_ as PC_class else: PC_class = PowComputer_base PC = PC_class(m, mpz_get_ui(cache_limit.value), mpz_get_ui(prec_cap.value), mpz_get_ui(prec_cap.value), in_field) diff --git a/src/sage/rings/padics/pow_computer_flint.pyx b/src/sage/rings/padics/pow_computer_flint.pyx index 059d8f02875..ca44219425b 100644 --- a/src/sage/rings/padics/pow_computer_flint.pyx +++ b/src/sage/rings/padics/pow_computer_flint.pyx @@ -642,13 +642,13 @@ def PowComputer_flint_maker(prime, cache_limit, prec_cap, ram_prec_cap, in_field """ if prec_type == 'capped-rel': - from .qadic_flint_CR import PowComputer_ + from sage.rings.padics.qadic_flint_CR import PowComputer_ elif prec_type == 'capped-abs': - from .qadic_flint_CA import PowComputer_ + from sage.rings.padics.qadic_flint_CA import PowComputer_ elif prec_type == 'fixed-mod': - from .qadic_flint_FM import PowComputer_ + from sage.rings.padics.qadic_flint_FM import PowComputer_ elif prec_type == 'floating-point': - from .qadic_flint_FP import PowComputer_ + from sage.rings.padics.qadic_flint_FP import PowComputer_ else: raise ValueError("unknown prec_type `%s`" % prec_type) return PowComputer_(prime, cache_limit, prec_cap, ram_prec_cap, in_field, poly) diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx index 80a16b71b3b..5cf28979ba7 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx @@ -253,7 +253,7 @@ from sage.misc.sage_eval import sage_eval import sage.rings.polynomial.polynomial_singular_interface cimport cypari2.gen -from . import polynomial_element +from sage.rings.polynomial import polynomial_element permstore=[] cdef class MPolynomialRing_libsingular(MPolynomialRing_base): diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index 2b8bda3f933..e2a67e00b15 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -23,9 +23,9 @@ from sage.arith.misc import binomial from sage.rings.integer_ring import ZZ -from . import polynomial_ring -from .term_order import TermOrder -from .polynomial_ring_constructor import (PolynomialRing, +from sage.rings.polynomial import polynomial_ring +from sage.rings.polynomial.term_order import TermOrder +from sage.rings.polynomial.polynomial_ring_constructor import (PolynomialRing, polynomial_default_category) @@ -136,7 +136,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): """ base = self.base_ring() if is_MPolynomialRing(base) or polynomial_ring.is_PolynomialRing(base): - from .flatten import FlatteningMorphism + from sage.rings.polynomial.flatten import FlatteningMorphism return FlatteningMorphism(self) else: return IdentityMorphism(self) @@ -158,7 +158,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): False """ - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.categories.pushout import MultiPolynomialFunctor return MultiPolynomialFunctor(self.variable_names(), self.term_order()), self.base_ring() @@ -324,7 +324,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): vars.remove(str(v)) if len(vars) == 0: return self.base_ring() - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if order is None: try: return PolynomialRing(self.base_ring(), vars, @@ -615,7 +615,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): a dict with respect to ``self.variable_names()``. """ # This is probably horribly inefficient - from .polydict import ETuple + from sage.rings.polynomial.polydict import ETuple other_vars = list(x.parent().variable_names()) name_mapping = [(other_vars.index(var) if var in other_vars else -1) for var in self.variable_names()] K = self.base_ring() @@ -706,7 +706,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): return "%s[%s]" % (sage.misc.latex.latex(self.base_ring()), vars) def _ideal_class_(self, n=0): - from .multi_polynomial_ideal import MPolynomialIdeal + from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal return MPolynomialIdeal def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): @@ -916,7 +916,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): elif not set(my_vars).issubset(set(vars)): while my_vars[-1] in vars: my_vars.pop() - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(self.base_ring(), my_vars) else: try: @@ -1358,7 +1358,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): if order is None: order = self.term_order() - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(base_ring, self.ngens(), names, order=order) def monomial(self, *exponents): @@ -1787,11 +1787,11 @@ cdef class BooleanPolynomialRing_base(MPolynomialRing_base): # Leave *all* old versions! def unpickle_MPolynomialRing_generic_v1(base_ring, n, names, order): - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(base_ring, n, names=names, order=order) def unpickle_MPolynomialRing_generic(base_ring, n, names, order): - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(base_ring, n, names=names, order=order) diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 19c742376cc..e4698d530b0 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -119,7 +119,7 @@ from sage.misc.derivative import multi_derivative from sage.arith.misc import sort_complex_numbers_for_display, power_mod, is_prime from sage.arith.functions import lcm -from . import polynomial_fateman +from sage.rings.polynomial import polynomial_fateman from sage.rings.ideal import is_Ideal from sage.rings.polynomial.polynomial_ring import is_PolynomialRing diff --git a/src/sage/rings/polynomial/polynomial_number_field.pyx b/src/sage/rings/polynomial/polynomial_number_field.pyx index 8029377bcb1..835e899c76e 100644 --- a/src/sage/rings/polynomial/polynomial_number_field.pyx +++ b/src/sage/rings/polynomial/polynomial_number_field.pyx @@ -73,7 +73,7 @@ We can also construct polynomials over relative number fields:: # http://www.gnu.org/licenses/ #***************************************************************************** -from .polynomial_element_generic import Polynomial_generic_dense_field +from sage.rings.polynomial.polynomial_element_generic import Polynomial_generic_dense_field from sage.rings.rational_field import QQ from sage.structure.element import coerce_binop from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing diff --git a/src/sage/rings/power_series_mpoly.pyx b/src/sage/rings/power_series_mpoly.pyx index 22cd86bfc72..44e456d8c4a 100644 --- a/src/sage/rings/power_series_mpoly.pyx +++ b/src/sage/rings/power_series_mpoly.pyx @@ -3,9 +3,9 @@ from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element -from .infinity import infinity -from .polynomial.multi_polynomial_ring_base import is_MPolynomialRing -from . import power_series_poly +from sage.rings.infinity import infinity +from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing +from sage.rings import power_series_poly cdef class PowerSeries_mpoly(PowerSeries): diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 55bef33c962..7df1dbb9ed8 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -7,7 +7,7 @@ The class ``PowerSeries_poly`` provides additional methods for univariate power """ from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element -from .infinity import infinity +from sage.rings.infinity import infinity try: from sage.libs.pari.all import pari_gen, PariError diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 144765bc1b6..5f93f7b0084 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -97,7 +97,7 @@ With power series the behavior is the same. # **************************************************************************** from cpython.object cimport Py_EQ, Py_NE -from .infinity import infinity, is_Infinite +from sage.rings.infinity import infinity, is_Infinite from sage.rings.rational_field import QQ @@ -105,7 +105,7 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing import sage.misc.misc import sage.arith.all as arith import sage.misc.latex -from .integer import Integer +from sage.rings.integer import Integer from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.categories.fields import Fields @@ -2956,7 +2956,7 @@ def _solve_linear_de(R, N, L, a, b, f0): def make_powerseries_poly_v0(parent, f, prec, is_gen): # This is only used to unpickle old pickles. The new pickling # works differently! - from . import power_series_poly + from sage.rings import power_series_poly return power_series_poly.PowerSeries_poly(parent, f, prec, 0, is_gen) diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 81dc2e2a61f..e49bcb3f0a0 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -75,7 +75,7 @@ import sage.rings.rational_field cimport sage.rings.integer as integer from sage.rings.integer cimport Integer -from .integer_ring import ZZ +from sage.rings.integer_ring import ZZ from sage.structure.coerce cimport is_numpy_type @@ -1777,7 +1777,7 @@ cdef class Rational(sage.structure.element.FieldElement): return (self > 0) ## Check that p is prime - from .integer_ring import ZZ + from sage.rings.integer_ring import ZZ p = ZZ(p) if check and not p.is_prime(): raise ValueError('p must be "infinity" or a positive prime number.') @@ -4122,8 +4122,8 @@ cdef class Z_to_Q(Morphism): From: Integer Ring To: Rational Field """ - from . import integer_ring - from . import rational_field + from sage.rings import integer_ring + from sage.rings import rational_field import sage.categories.homset Morphism.__init__(self, sage.categories.homset.Hom(integer_ring.ZZ, rational_field.QQ)) @@ -4243,7 +4243,7 @@ cdef class int_to_Q(Morphism): From: Set of Python objects of class 'int' To: Rational Field """ - from . import rational_field + from sage.rings import rational_field import sage.categories.homset from sage.sets.pythonclass import Set_PythonType Morphism.__init__(self, sage.categories.homset.Hom( diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index e8ccad5311b..5259001cfbf 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -352,9 +352,9 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): if S is int or S is float: return ToRDF(S) - from .rational_field import QQ + from sage.rings.rational_field import QQ try: - from .real_lazy import RLF + from sage.rings.real_lazy import RLF except ImportError: RLF = None @@ -374,7 +374,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): return None try: - from .real_mpfr import RR + from sage.rings.real_mpfr import RR except ImportError: pass else: @@ -456,7 +456,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): if prec == 53: return self else: - from .real_mpfr import RealField + from sage.rings.real_mpfr import RealField return RealField(prec) @@ -1004,7 +1004,7 @@ cdef class RealDoubleElement(FieldElement): sage: mathematica(RDF(1e-25)) # optional - mathematica 1.*^-25 """ - from .real_mpfr import RR + from sage.rings.real_mpfr import RR return RR(self._value)._mathematica_init_() def _sage_input_(self, sib, coerced): @@ -2378,7 +2378,7 @@ def is_RealDoubleElement(x): cdef RealDoubleElement global_dummy_element try: - from .real_double_element_gsl import RealDoubleElement_gsl + from sage.rings.real_double_element_gsl import RealDoubleElement_gsl except ImportError: global_dummy_element = RealDoubleElement(0) else: @@ -2484,7 +2484,7 @@ cdef void fast_tp_dealloc(PyObject* o): from sage.misc.allocator cimport hook_tp_functions, hook_tp_functions_type hook_tp_functions(global_dummy_element, (&fast_tp_new), (&fast_tp_dealloc), False) try: - from .real_double_element_gsl import RealDoubleElement_gsl + from sage.rings.real_double_element_gsl import RealDoubleElement_gsl except Exception: pass else: diff --git a/src/sage/rings/real_double_element_gsl.pyx b/src/sage/rings/real_double_element_gsl.pyx index 1edc24a986b..caa47f4dad9 100644 --- a/src/sage/rings/real_double_element_gsl.pyx +++ b/src/sage/rings/real_double_element_gsl.pyx @@ -217,10 +217,10 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): cdef _log_base(self, double log_of_base): if self._value == 0: - from .real_double import RDF + from sage.rings.real_double import RDF return RDF(-1)/RDF(0) elif self._value < 0: - from .real_double import RDF + from sage.rings.real_double import RDF return RDF.NaN() sig_on() a = self._new_c(gsl_sf_log(self._value) / log_of_base) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 00b08ad3ab6..d2cbe35b77a 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -273,8 +273,8 @@ from sage.structure.richcmp cimport richcmp from sage.rings.convert.mpfi cimport mpfi_set_sage from sage.rings.real_mpfr cimport RealField_class, RealNumber, RealField from sage.rings.integer cimport Integer -from .integer_ring import ZZ -from .rational_field import QQ +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ cimport sage.rings.abc diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index f8f98ad6605..063bf297737 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -729,9 +729,9 @@ cdef class RealField_class(sage.rings.abc.RealField): sage: R.get_action(ZZ) Right scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Real Field with 53 bits of precision """ - from .integer_ring import ZZ - from .rational_field import QQ - from .real_double import RDF + from sage.rings.integer_ring import ZZ + from sage.rings.rational_field import QQ + from sage.rings.real_double import RDF if S is ZZ: return ZZtoRR(ZZ, self) @@ -1833,7 +1833,7 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RealField(100)(2).imag() 0 """ - from .integer_ring import ZZ + from sage.rings.integer_ring import ZZ return ZZ(0) @@ -2347,7 +2347,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._add_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -2371,7 +2371,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._sub_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -2395,7 +2395,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._mul_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -2419,7 +2419,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._div_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -3630,7 +3630,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if mpfr_zero_p(self.value): return Rational(0) - from .real_mpfi import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField cdef mpfr_rnd_t rnd = (self._parent).rnd cdef mpfr_prec_t prec = (self._parent)._prec @@ -3750,7 +3750,7 @@ cdef class RealNumber(sage.structure.element.RingElement): raise ValueError('Must specify exactly one of max_error or max_denominator in nearby_rational()') if max_error is not None: - from .real_mpfi import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField intv_field = RealIntervalField(self.prec()) intv = intv_field(self - max_error, self + max_error) @@ -5579,7 +5579,7 @@ cdef class RealNumber(sage.structure.element.RingElement): # If we got here, then we're not a perfect power of a boundary # point, so it's safe to use the interval arithmetic technique. - from .real_mpfi import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField cdef mpfr_prec_t prec = fld._prec + 10 diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index f44b562a9a6..df8d9b8fc31 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -1449,7 +1449,7 @@ cdef class CommutativeRing(Ring): sage: f(1+u) 1 + u^25 """ - from .morphism import FrobeniusEndomorphism_generic + from sage.rings.morphism import FrobeniusEndomorphism_generic return FrobeniusEndomorphism_generic(self, n) def derivation_module(self, codomain=None, twist=None): diff --git a/src/sage/rings/sum_of_squares.pyx b/src/sage/rings/sum_of_squares.pyx index 9407bbae277..93cfc98c921 100644 --- a/src/sage/rings/sum_of_squares.pyx +++ b/src/sage/rings/sum_of_squares.pyx @@ -23,7 +23,7 @@ from libc.math cimport sqrt from cysignals.signals cimport sig_on, sig_off cimport sage.rings.integer as integer -from . import integer +from sage.rings import integer cdef int two_squares_c(uint_fast32_t n, uint_fast32_t res[2]): r""" diff --git a/src/sage/sat/solvers/satsolver.pyx b/src/sage/sat/solvers/satsolver.pyx index 03a3730e265..e7d01f9f497 100644 --- a/src/sage/sat/solvers/satsolver.pyx +++ b/src/sage/sat/solvers/satsolver.pyx @@ -391,16 +391,16 @@ def SAT(solver=None, *args, **kwds): from sage.sat.solvers.picosat import PicoSAT return PicoSAT(*args, **kwds) elif solver == "LP": - from .sat_lp import SatLP + from sage.sat.solvers.sat_lp import SatLP return SatLP() elif solver == 'glucose': - from .dimacs import Glucose + from sage.sat.solvers.dimacs import Glucose return Glucose(*args, **kwds) elif solver == 'glucose-syrup': - from .dimacs import GlucoseSyrup + from sage.sat.solvers.dimacs import GlucoseSyrup return GlucoseSyrup(*args, **kwds) elif solver == 'kissat': - from .dimacs import Kissat + from sage.sat.solvers.dimacs import Kissat return Kissat(*args, **kwds) else: raise ValueError("Solver '{}' is not available".format(solver)) diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 938f11c9c51..86597c8ba8e 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -89,7 +89,7 @@ from sage.structure.richcmp cimport rich_to_bool, revop from sage.structure.sage_object cimport SageObject from sage.structure.parent cimport Parent_richcmp_element_without_coercion from sage.structure.element cimport bin_op_exception, parent, Element -from .coerce_exceptions import CoercionException +from sage.structure.coerce_exceptions import CoercionException from sage.rings.integer_fake cimport is_Integer from sage.categories.map cimport Map from sage.categories.morphism import IdentityMorphism diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx index 084fe4b06c1..fc8e7b6d7c8 100644 --- a/src/sage/structure/coerce_actions.pyx +++ b/src/sage/structure/coerce_actions.pyx @@ -22,7 +22,7 @@ from cysignals.signals cimport sig_check from sage.structure.coerce cimport coercion_model from sage.structure.element cimport parent, Element, ModuleElement from sage.structure.parent cimport Parent -from .coerce_exceptions import CoercionException +from sage.structure.coerce_exceptions import CoercionException from sage.categories.action cimport InverseAction, PrecomposedAction from sage.arith.long cimport integer_check_long diff --git a/src/sage/structure/parent.pyx b/src/sage/structure/parent.pyx index 6e786ca2e7c..2d2cb9704cd 100644 --- a/src/sage/structure/parent.pyx +++ b/src/sage/structure/parent.pyx @@ -120,10 +120,10 @@ from sage.misc.lazy_attribute import lazy_attribute from sage.categories.sets_cat import Sets, EmptySetError from sage.misc.lazy_string cimport _LazyString from sage.sets.pythonclass cimport Set_PythonType_class -from .category_object import CategoryObject +from sage.structure.category_object import CategoryObject from sage.structure.coerce cimport coercion_model from sage.structure.coerce cimport parent_is_integers -from .coerce_exceptions import CoercionException +from sage.structure.coerce_exceptions import CoercionException from sage.structure.coerce_maps cimport (NamedConvertMap, DefaultConvertMap, DefaultConvertMap_unique, CallableConvertMap) from sage.structure.element cimport parent @@ -2672,7 +2672,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): _register_pair(self, S, "action") # avoid possible infinite loops # detect actions defined by _rmul_, _lmul_, _act_on_, and _acted_upon_ methods - from .coerce_actions import detect_element_action + from sage.structure.coerce_actions import detect_element_action action = detect_element_action(self, S, self_on_left, self_el, S_el) if action is not None: return action diff --git a/src/sage/structure/parent_base.pyx b/src/sage/structure/parent_base.pyx index 8fa4894d936..7cef8f692c5 100644 --- a/src/sage/structure/parent_base.pyx +++ b/src/sage/structure/parent_base.pyx @@ -13,7 +13,7 @@ Base class for old-style parent objects with a base ring # **************************************************************************** cimport sage.structure.parent as parent -from .coerce_exceptions import CoercionException +from sage.structure.coerce_exceptions import CoercionException cdef inline check_old_coerce(parent.Parent p): if p._element_constructor is not None: diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 64cf4473d1e..f076e14d462 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -949,7 +949,7 @@ cdef class Expression(Expression_abc): if state[0] != 0 or len(state) != 3: raise ValueError("unknown state information") # set parent - from .ring import SR + from sage.symbolic.ring import SR self._parent = SR # get variables cdef GExList sym_lst @@ -993,7 +993,7 @@ cdef class Expression(Expression_abc): True """ - from .ring import SR + from sage.symbolic.ring import SR SR.cleanup_var(self) return False @@ -3277,7 +3277,7 @@ cdef class Expression(Expression_abc): sage: x.is_trivially_equal(QQbar(1/2)) True """ - from .ring import SR + from sage.symbolic.ring import SR cdef Expression _other = (SR(other)) sig_on() try: @@ -12184,7 +12184,7 @@ cdef class Expression(Expression_abc): ... ValueError: cannot convert """ - from . import units + from sage.symbolic import units return units.convert(self, target) ################################################################### diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx index 2796adf399c..b3bf8c985e4 100644 --- a/src/sage/symbolic/function.pyx +++ b/src/sage/symbolic/function.pyx @@ -149,10 +149,10 @@ from sage.structure.richcmp cimport richcmp from sage.misc.fpickle import pickle_function, unpickle_function -from .symbols import symbol_table, register_symbol +from sage.symbolic.symbols import symbol_table, register_symbol try: - from .expression import ( + from sage.symbolic.expression import ( call_registered_function, find_registered_function, register_or_update_function, get_sfunction_from_hash, get_sfunction_from_serial as get_sfunction_from_serial ) @@ -543,7 +543,7 @@ cdef class Function(SageObject): if result is not None: return result - from .ring import SR + from sage.symbolic.ring import SR if coerce: try: @@ -621,7 +621,7 @@ cdef class Function(SageObject): sage: sin.default_variable() # needs sage.symbolic x """ - from .ring import SR + from sage.symbolic.ring import SR return SR.var('x') def _is_numerical(self, x): @@ -1067,7 +1067,7 @@ cdef class BuiltinFunction(Function): if (self._preserved_arg and isinstance(args[self._preserved_arg-1], Element)): arg_parent = parent(args[self._preserved_arg-1]) - from .ring import SR + from sage.symbolic.ring import SR if arg_parent is SR: return res from sage.rings.polynomial.polynomial_ring import PolynomialRing_commutative diff --git a/src/sage/symbolic/pynac_impl.pxi b/src/sage/symbolic/pynac_impl.pxi index b83a565dcb1..ff77b52a5ac 100644 --- a/src/sage/symbolic/pynac_impl.pxi +++ b/src/sage/symbolic/pynac_impl.pxi @@ -81,7 +81,7 @@ cdef ex_to_pyExpression(GEx juice): cdef Expression nex nex = Expression.__new__(Expression) nex._gobj = GEx(juice) - from .ring import SR + from sage.symbolic.ring import SR nex._parent = SR return nex @@ -200,7 +200,7 @@ cdef GEx pyExpression_to_ex(res) except *: """ if res is None: raise TypeError("function returned None, expected return value of type sage.symbolic.expression.Expression") - from .ring import SR + from sage.symbolic.ring import SR try: t = SR.coerce(res) except TypeError as err: @@ -1167,7 +1167,7 @@ cdef bint py_is_integer(x): if not isinstance(x, Element): return False P = (x)._parent - from .ring import SymbolicRing + from sage.symbolic.ring import SymbolicRing return (isinstance(P, SymbolicRing) or P.is_exact()) and x in ZZ @@ -1257,7 +1257,7 @@ cdef bint py_is_exact(x): if not isinstance(x, Element): return False P = (x)._parent - from .ring import SymbolicRing + from sage.symbolic.ring import SymbolicRing return isinstance(P, SymbolicRing) or P.is_exact() @@ -1564,7 +1564,7 @@ cdef py_step(n): """ Return step function of n. """ - from .ring import SR + from sage.symbolic.ring import SR if n < 0: return SR(0) elif n > 0: @@ -2474,7 +2474,7 @@ def init_pynac_I(): from sage.rings.cc import CC pynac_I = CC(0, 1) ginac_pyinit_I(pynac_I) - from .ring import SR + from sage.symbolic.ring import SR return new_Expression_from_GEx(SR, g_I) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index bdaa138b77b..c7c04c9f710 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -214,7 +214,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): from sage.rings.real_lazy import RLF, CLF from sage.rings.finite_rings.finite_field_base import FiniteField - from .subring import GenericSymbolicSubring + from sage.symbolic.subring import GenericSymbolicSubring if R._is_numerical(): # Almost anything with a coercion into any precision of CC @@ -1134,7 +1134,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): """ if self is not SR: raise NotImplementedError('cannot create subring of %s' % (self,)) - from .subring import SymbolicSubring + from sage.symbolic.subring import SymbolicSubring return SymbolicSubring(*args, **kwds) def _fricas_init_(self):