From 22f6eacb3f89b9373b5f00d8a508e6fd90f2c170 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 30 Oct 2023 18:06:20 -0700 Subject: [PATCH 1/3] Replace relative cimports --- src/sage/matrix/change_ring.pyx | 4 ++-- src/sage/matrix/constructor.pyx | 2 +- src/sage/matrix/matrix.pxd | 2 +- src/sage/matrix/matrix1.pxd | 2 +- src/sage/matrix/matrix2.pxd | 2 +- src/sage/matrix/matrix_complex_ball_dense.pxd | 2 +- src/sage/matrix/matrix_complex_ball_dense.pyx | 2 +- src/sage/matrix/matrix_complex_double_dense.pxd | 2 +- src/sage/matrix/matrix_cyclo_dense.pxd | 4 ++-- src/sage/matrix/matrix_cyclo_dense.pyx | 6 +++--- src/sage/matrix/matrix_dense.pxd | 2 +- src/sage/matrix/matrix_domain_dense.pxd | 2 +- src/sage/matrix/matrix_domain_sparse.pxd | 2 +- src/sage/matrix/matrix_double_dense.pxd | 2 +- src/sage/matrix/matrix_double_sparse.pxd | 3 ++- src/sage/matrix/matrix_double_sparse.pyx | 5 +++-- src/sage/matrix/matrix_gap.pxd | 4 ++-- src/sage/matrix/matrix_gap.pyx | 2 +- src/sage/matrix/matrix_generic_dense.pxd | 3 ++- src/sage/matrix/matrix_generic_dense.pyx | 2 +- src/sage/matrix/matrix_generic_sparse.pxd | 3 ++- src/sage/matrix/matrix_generic_sparse.pyx | 2 +- src/sage/matrix/matrix_gf2e_dense.pxd | 2 +- src/sage/matrix/matrix_gf2e_dense.pyx | 2 +- src/sage/matrix/matrix_integer_dense.pxd | 2 +- src/sage/matrix/matrix_integer_dense.pyx | 12 ++++++------ src/sage/matrix/matrix_integer_sparse.pxd | 2 +- src/sage/matrix/matrix_integer_sparse.pyx | 8 ++++---- src/sage/matrix/matrix_mod2_dense.pyx | 2 +- src/sage/matrix/matrix_modn_dense_template.pxi | 2 +- src/sage/matrix/matrix_modn_sparse.pyx | 1 - src/sage/matrix/matrix_numpy_dense.pxd | 3 ++- src/sage/matrix/matrix_numpy_dense.pyx | 2 +- src/sage/matrix/matrix_numpy_integer_dense.pxd | 2 +- src/sage/matrix/matrix_rational_dense.pxd | 2 +- src/sage/matrix/matrix_rational_dense.pyx | 6 +++--- src/sage/matrix/matrix_rational_sparse.pxd | 2 +- src/sage/matrix/matrix_rational_sparse.pyx | 8 ++++---- src/sage/matrix/matrix_real_double_dense.pxd | 3 ++- src/sage/matrix/matrix_symbolic_dense.pxd | 3 ++- src/sage/matrix/matrix_symbolic_dense.pyx | 2 +- src/sage/matrix/matrix_symbolic_sparse.pxd | 3 ++- src/sage/matrix/matrix_symbolic_sparse.pyx | 2 +- src/sage/matrix/matrix_window.pxd | 3 ++- src/sage/matrix/misc.pyx | 6 +++--- src/sage/matrix/misc_flint.pyx | 4 ++-- src/sage/matrix/misc_mpfr.pyx | 2 +- src/sage/matrix/strassen.pyx | 2 +- src/sage/matrix/template.pxd | 3 ++- src/sage/matroids/basis_exchange_matroid.pxd | 4 ++-- src/sage/matroids/basis_exchange_matroid.pyx | 4 ++-- src/sage/matroids/basis_matroid.pxd | 6 +++--- src/sage/matroids/basis_matroid.pyx | 6 +++--- src/sage/matroids/circuit_closures_matroid.pxd | 3 ++- src/sage/matroids/circuit_closures_matroid.pyx | 4 ++-- src/sage/matroids/extension.pxd | 2 +- src/sage/matroids/extension.pyx | 2 +- src/sage/matroids/linear_matroid.pxd | 6 +++--- src/sage/matroids/matroid.pyx | 4 ++-- src/sage/matroids/union_matroid.pxd | 3 ++- src/sage/matroids/union_matroid.pyx | 2 +- src/sage/matroids/unpickling.pyx | 8 ++++---- src/sage/modules/vector_complex_double_dense.pxd | 3 ++- src/sage/modules/vector_double_dense.pxd | 3 ++- src/sage/modules/vector_integer_dense.pxd | 3 ++- src/sage/modules/vector_modn_dense.pxd | 4 ++-- src/sage/modules/vector_numpy_dense.pxd | 4 +++- src/sage/modules/vector_numpy_integer_dense.pxd | 3 ++- src/sage/modules/vector_rational_dense.pxd | 3 ++- src/sage/modules/vector_real_double_dense.pxd | 4 ++-- .../distributions/discrete_gaussian_integer.pxd | 8 ++++---- .../distributions/discrete_gaussian_integer.pyx | 6 +++--- src/sage/stats/hmm/chmm.pyx | 6 +++--- src/sage/stats/hmm/hmm.pyx | 2 +- 74 files changed, 136 insertions(+), 118 deletions(-) diff --git a/src/sage/matrix/change_ring.pyx b/src/sage/matrix/change_ring.pyx index c14d6540849..53e840b4663 100644 --- a/src/sage/matrix/change_ring.pyx +++ b/src/sage/matrix/change_ring.pyx @@ -3,8 +3,8 @@ Functions for changing the base ring of matrices quickly """ from .matrix_space import MatrixSpace -from .matrix_real_double_dense cimport Matrix_real_double_dense -from .matrix_integer_dense cimport Matrix_integer_dense +from sage.matrix.matrix_real_double_dense cimport Matrix_real_double_dense +from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense from sage.rings.real_double import RDF diff --git a/src/sage/matrix/constructor.pyx b/src/sage/matrix/constructor.pyx index a31543e0795..536fe7bdf29 100644 --- a/src/sage/matrix/constructor.pyx +++ b/src/sage/matrix/constructor.pyx @@ -14,7 +14,7 @@ General matrix Constructor and display options # http://www.gnu.org/licenses/ #***************************************************************************** -from .args cimport MatrixArgs +from sage.matrix.args cimport MatrixArgs from sage.structure.global_options import GlobalOptions diff --git a/src/sage/matrix/matrix.pxd b/src/sage/matrix/matrix.pxd index 72ba0b09531..b67ed5b4969 100644 --- a/src/sage/matrix/matrix.pxd +++ b/src/sage/matrix/matrix.pxd @@ -1 +1 @@ -from .matrix2 cimport Matrix +from sage.matrix.matrix2 cimport Matrix diff --git a/src/sage/matrix/matrix1.pxd b/src/sage/matrix/matrix1.pxd index 666cd4e6240..e3585f9caab 100644 --- a/src/sage/matrix/matrix1.pxd +++ b/src/sage/matrix/matrix1.pxd @@ -1,4 +1,4 @@ -from .matrix0 cimport Matrix as Matrix0 +from sage.matrix.matrix0 cimport Matrix as Matrix0 cdef class Matrix(Matrix0): cdef _stack_impl(self, bottom) noexcept diff --git a/src/sage/matrix/matrix2.pxd b/src/sage/matrix/matrix2.pxd index ad5bf85df04..1fd85c5f082 100644 --- a/src/sage/matrix/matrix2.pxd +++ b/src/sage/matrix/matrix2.pxd @@ -12,7 +12,7 @@ Generic matrices # http://www.gnu.org/licenses/ #***************************************************************************** -from .matrix1 cimport Matrix as Matrix1 +from sage.matrix.matrix1 cimport Matrix as Matrix1 cdef class Matrix(Matrix1): cdef _det_by_minors(self, Py_ssize_t level) noexcept diff --git a/src/sage/matrix/matrix_complex_ball_dense.pxd b/src/sage/matrix/matrix_complex_ball_dense.pxd index 622925a0ee9..9a17089a1c7 100644 --- a/src/sage/matrix/matrix_complex_ball_dense.pxd +++ b/src/sage/matrix/matrix_complex_ball_dense.pxd @@ -1,5 +1,5 @@ from sage.libs.arb.types cimport acb_mat_t -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense from sage.structure.parent cimport Parent diff --git a/src/sage/matrix/matrix_complex_ball_dense.pyx b/src/sage/matrix/matrix_complex_ball_dense.pyx index 22366b5f1f2..54ce6002d5c 100644 --- a/src/sage/matrix/matrix_complex_ball_dense.pyx +++ b/src/sage/matrix/matrix_complex_ball_dense.pyx @@ -40,7 +40,7 @@ from sage.libs.arb.acb cimport * from sage.libs.arb.acb_mat cimport * from sage.libs.gmp.mpz cimport mpz_fits_ulong_p, mpz_get_ui from sage.matrix.constructor import matrix -from .args cimport SparseEntry, MatrixArgs_init +from sage.matrix.args cimport SparseEntry, MatrixArgs_init from sage.rings.complex_interval cimport ComplexIntervalFieldElement from sage.rings.complex_arb cimport ( ComplexBall, diff --git a/src/sage/matrix/matrix_complex_double_dense.pxd b/src/sage/matrix/matrix_complex_double_dense.pxd index 0ad83958941..a9041564e43 100644 --- a/src/sage/matrix/matrix_complex_double_dense.pxd +++ b/src/sage/matrix/matrix_complex_double_dense.pxd @@ -1,4 +1,4 @@ -from .matrix_double_dense cimport Matrix_double_dense +from sage.matrix.matrix_double_dense cimport Matrix_double_dense cdef class Matrix_complex_double_dense(Matrix_double_dense): pass diff --git a/src/sage/matrix/matrix_cyclo_dense.pxd b/src/sage/matrix/matrix_cyclo_dense.pxd index 1ce4e1e1cfd..d6c8711f862 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pxd +++ b/src/sage/matrix/matrix_cyclo_dense.pxd @@ -1,6 +1,6 @@ from sage.libs.gmp.types cimport mpz_t -from .matrix_dense cimport Matrix_dense -from .matrix_rational_dense cimport Matrix_rational_dense +from sage.matrix.matrix_dense cimport Matrix_dense +from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense cdef class Matrix_cyclo_dense(Matrix_dense): diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index c3ec3ebf81a..6a048a78edc 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -56,12 +56,12 @@ from sage.libs.flint.fmpz cimport fmpz_init, fmpz_clear, fmpz_set_mpz, fmpz_one, 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 .args cimport MatrixArgs_init +from sage.matrix.args cimport MatrixArgs_init from .constructor import matrix from .matrix_space import MatrixSpace -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix from . import matrix_dense -from .matrix_integer_dense cimport _lift_crt +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 diff --git a/src/sage/matrix/matrix_dense.pxd b/src/sage/matrix/matrix_dense.pxd index 3343438682b..30c3effe02a 100644 --- a/src/sage/matrix/matrix_dense.pxd +++ b/src/sage/matrix/matrix_dense.pxd @@ -1,4 +1,4 @@ -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix cdef class Matrix_dense(Matrix): cdef void set_unsafe_int(self, Py_ssize_t i, Py_ssize_t j, int value) noexcept diff --git a/src/sage/matrix/matrix_domain_dense.pxd b/src/sage/matrix/matrix_domain_dense.pxd index 92e37e22afb..8a6e487c493 100644 --- a/src/sage/matrix/matrix_domain_dense.pxd +++ b/src/sage/matrix/matrix_domain_dense.pxd @@ -1,4 +1,4 @@ -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix cdef class Matrix_domain_dense(Matrix): pass diff --git a/src/sage/matrix/matrix_domain_sparse.pxd b/src/sage/matrix/matrix_domain_sparse.pxd index 42eab458643..c5882238632 100644 --- a/src/sage/matrix/matrix_domain_sparse.pxd +++ b/src/sage/matrix/matrix_domain_sparse.pxd @@ -1,4 +1,4 @@ -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix cdef class Matrix_domain_sparse(Matrix): pass diff --git a/src/sage/matrix/matrix_double_dense.pxd b/src/sage/matrix/matrix_double_dense.pxd index db1feffa053..3f2cb525b10 100644 --- a/src/sage/matrix/matrix_double_dense.pxd +++ b/src/sage/matrix/matrix_double_dense.pxd @@ -1,4 +1,4 @@ -from .matrix_numpy_dense cimport Matrix_numpy_dense +from sage.matrix.matrix_numpy_dense cimport Matrix_numpy_dense cdef class Matrix_double_dense(Matrix_numpy_dense): diff --git a/src/sage/matrix/matrix_double_sparse.pxd b/src/sage/matrix/matrix_double_sparse.pxd index ba8b303878b..0a292404338 100644 --- a/src/sage/matrix/matrix_double_sparse.pxd +++ b/src/sage/matrix/matrix_double_sparse.pxd @@ -1,4 +1,5 @@ -from .matrix_generic_sparse cimport Matrix_generic_sparse +from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse + cdef class Matrix_double_sparse(Matrix_generic_sparse): pass diff --git a/src/sage/matrix/matrix_double_sparse.pyx b/src/sage/matrix/matrix_double_sparse.pyx index adf285a311c..c82f6f838ab 100644 --- a/src/sage/matrix/matrix_double_sparse.pyx +++ b/src/sage/matrix/matrix_double_sparse.pyx @@ -1,5 +1,6 @@ -from .matrix2 cimport Matrix -from .matrix_generic_sparse cimport Matrix_generic_sparse +from sage.matrix.matrix2 cimport Matrix +from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse + cdef class Matrix_double_sparse(Matrix_generic_sparse): r""" diff --git a/src/sage/matrix/matrix_gap.pxd b/src/sage/matrix/matrix_gap.pxd index bb4801258cf..da8fe7e1277 100644 --- a/src/sage/matrix/matrix_gap.pxd +++ b/src/sage/matrix/matrix_gap.pxd @@ -1,9 +1,9 @@ -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense from sage.libs.gap.element cimport GapElement + cdef class Matrix_gap(Matrix_dense): cdef GapElement _libgap cpdef GapElement gap(self) noexcept cdef Matrix_gap _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept - diff --git a/src/sage/matrix/matrix_gap.pyx b/src/sage/matrix/matrix_gap.pyx index 853cb0626a1..9bdbe54a283 100644 --- a/src/sage/matrix/matrix_gap.pyx +++ b/src/sage/matrix/matrix_gap.pyx @@ -13,7 +13,7 @@ Wrappers on GAP matrices from sage.libs.gap.libgap import libgap from sage.structure.element cimport Matrix -from .args cimport MatrixArgs_init +from sage.matrix.args cimport MatrixArgs_init cdef class Matrix_gap(Matrix_dense): diff --git a/src/sage/matrix/matrix_generic_dense.pxd b/src/sage/matrix/matrix_generic_dense.pxd index 86963fe05df..839efd22159 100644 --- a/src/sage/matrix/matrix_generic_dense.pxd +++ b/src/sage/matrix/matrix_generic_dense.pxd @@ -1,4 +1,5 @@ -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense + cdef class Matrix_generic_dense(Matrix_dense): cdef list _entries diff --git a/src/sage/matrix/matrix_generic_dense.pyx b/src/sage/matrix/matrix_generic_dense.pyx index 3e51e0d1703..527ef1b48f6 100644 --- a/src/sage/matrix/matrix_generic_dense.pyx +++ b/src/sage/matrix/matrix_generic_dense.pyx @@ -9,7 +9,7 @@ from cpython.ref cimport * cimport sage.matrix.matrix_dense as matrix_dense from . import matrix_dense -from .args cimport MatrixArgs_init +from sage.matrix.args cimport MatrixArgs_init cimport sage.matrix.matrix as matrix diff --git a/src/sage/matrix/matrix_generic_sparse.pxd b/src/sage/matrix/matrix_generic_sparse.pxd index f4d1465318f..461fb38e18b 100644 --- a/src/sage/matrix/matrix_generic_sparse.pxd +++ b/src/sage/matrix/matrix_generic_sparse.pxd @@ -1,4 +1,5 @@ -from .matrix_sparse cimport Matrix_sparse +from sage.matrix.matrix_sparse cimport Matrix_sparse + cdef class Matrix_generic_sparse(Matrix_sparse): cdef dict _entries diff --git a/src/sage/matrix/matrix_generic_sparse.pyx b/src/sage/matrix/matrix_generic_sparse.pyx index 2570d08b55d..5fa8894c2a9 100644 --- a/src/sage/matrix/matrix_generic_sparse.pyx +++ b/src/sage/matrix/matrix_generic_sparse.pyx @@ -55,7 +55,7 @@ EXAMPLES:: """ cimport sage.matrix.matrix_sparse as matrix_sparse cimport sage.structure.element -from .args cimport MatrixArgs_init +from sage.matrix.args cimport MatrixArgs_init cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse): diff --git a/src/sage/matrix/matrix_gf2e_dense.pxd b/src/sage/matrix/matrix_gf2e_dense.pxd index 70391868740..485266e517b 100644 --- a/src/sage/matrix/matrix_gf2e_dense.pxd +++ b/src/sage/matrix/matrix_gf2e_dense.pxd @@ -1,6 +1,6 @@ from sage.libs.m4rie cimport mzed_t from sage.libs.m4ri cimport m4ri_word -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense cdef class Matrix_gf2e_dense(Matrix_dense): diff --git a/src/sage/matrix/matrix_gf2e_dense.pyx b/src/sage/matrix/matrix_gf2e_dense.pyx index 25db5315598..c1c3ee3a0c4 100644 --- a/src/sage/matrix/matrix_gf2e_dense.pyx +++ b/src/sage/matrix/matrix_gf2e_dense.pyx @@ -95,7 +95,7 @@ from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from sage.misc.randstate cimport randstate, current_randstate from sage.matrix.matrix_mod2_dense cimport Matrix_mod2_dense -from .args cimport SparseEntry, MatrixArgs_init +from sage.matrix.args cimport SparseEntry, MatrixArgs_init from sage.libs.m4ri cimport m4ri_word, mzd_copy from sage.libs.m4rie cimport * diff --git a/src/sage/matrix/matrix_integer_dense.pxd b/src/sage/matrix/matrix_integer_dense.pxd index d606deacc45..dcc69db5d72 100644 --- a/src/sage/matrix/matrix_integer_dense.pxd +++ b/src/sage/matrix/matrix_integer_dense.pxd @@ -1,7 +1,7 @@ from sage.libs.gmp.types cimport * from sage.libs.flint.types cimport fmpz_mat_t -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense from sage.rings.integer cimport Integer from sage.ext.mod_int cimport * diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 207aa73a592..26e2e766d30 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -86,7 +86,7 @@ from sage.structure.proof.proof import get_flag as get_proof_flag from sage.structure.richcmp cimport rich_to_bool from sage.misc.randstate cimport randstate, current_randstate -from .args cimport SparseEntry, MatrixArgs_init +from sage.matrix.args cimport SparseEntry, MatrixArgs_init ######################################################### # PARI C library @@ -114,18 +114,18 @@ from sage.rings.polynomial.polynomial_integer_dense_flint cimport Polynomial_int from sage.structure.element cimport Element, Vector from sage.structure.element import is_Vector -from .matrix_modn_dense_float cimport Matrix_modn_dense_template -from .matrix_modn_dense_float cimport Matrix_modn_dense_float -from .matrix_modn_dense_double cimport Matrix_modn_dense_double +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 .matrix_mod2_dense cimport 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 .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix cimport sage.structure.element diff --git a/src/sage/matrix/matrix_integer_sparse.pxd b/src/sage/matrix/matrix_integer_sparse.pxd index d69b4879dc5..fa130f9e680 100644 --- a/src/sage/matrix/matrix_integer_sparse.pxd +++ b/src/sage/matrix/matrix_integer_sparse.pxd @@ -1,6 +1,6 @@ from sage.modules.vector_integer_sparse cimport mpz_vector from sage.ext.mod_int cimport mod_int -from .matrix_sparse cimport Matrix_sparse +from sage.matrix.matrix_sparse cimport Matrix_sparse cdef class Matrix_integer_sparse(Matrix_sparse): cdef mpz_vector* _matrix diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx index 0712500e67d..16e577e9b40 100644 --- a/src/sage/matrix/matrix_integer_sparse.pyx +++ b/src/sage/matrix/matrix_integer_sparse.pyx @@ -53,15 +53,15 @@ from sage.libs.gmp.mpz cimport * from sage.rings.integer cimport Integer from sage.rings.polynomial.polynomial_integer_dense_flint cimport Polynomial_integer_dense_flint -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix -from .args cimport SparseEntry, MatrixArgs_init -from .matrix_integer_dense cimport Matrix_integer_dense +from sage.matrix.args cimport SparseEntry, MatrixArgs_init +from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense from sage.libs.flint.fmpz cimport fmpz_set_mpz, fmpz_get_mpz from sage.libs.flint.fmpz_poly cimport fmpz_poly_fit_length, fmpz_poly_set_coeff_mpz, _fmpz_poly_set_length from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry -from .matrix_modn_sparse cimport Matrix_modn_sparse +from sage.matrix.matrix_modn_sparse cimport Matrix_modn_sparse from sage.structure.element cimport Element import sage.matrix.matrix_space as matrix_space diff --git a/src/sage/matrix/matrix_mod2_dense.pyx b/src/sage/matrix/matrix_mod2_dense.pyx index 98708b4e9fb..1db7e22aa1a 100644 --- a/src/sage/matrix/matrix_mod2_dense.pyx +++ b/src/sage/matrix/matrix_mod2_dense.pyx @@ -109,7 +109,7 @@ from cysignals.memory cimport check_malloc, sig_free from cysignals.signals cimport sig_on, sig_str, sig_off cimport sage.matrix.matrix_dense as matrix_dense -from .args cimport SparseEntry, MatrixArgs_init +from sage.matrix.args cimport SparseEntry, MatrixArgs_init from libc.stdio cimport * from sage.structure.element cimport (Matrix, Vector) from sage.modules.free_module_element cimport FreeModuleElement diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index 55cff5b9ac7..afa84130974 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -123,7 +123,7 @@ from sage.structure.proof.proof import get_flag as get_proof_flag from sage.structure.richcmp cimport rich_to_bool from sage.misc.randstate cimport randstate, current_randstate import sage.matrix.matrix_space as matrix_space -from .args cimport SparseEntry, MatrixArgs_init +from sage.matrix.args cimport SparseEntry, MatrixArgs_init from sage.cpython.string cimport char_to_str diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index 235fc4e7b81..edcd75a1a77 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- r""" Sparse matrices over `\ZZ/n\ZZ` for `n` small diff --git a/src/sage/matrix/matrix_numpy_dense.pxd b/src/sage/matrix/matrix_numpy_dense.pxd index fafc6fda5f7..150f9d59551 100644 --- a/src/sage/matrix/matrix_numpy_dense.pxd +++ b/src/sage/matrix/matrix_numpy_dense.pxd @@ -1,6 +1,7 @@ -from .matrix_dense cimport Matrix_dense cimport numpy as cnumpy +from sage.matrix.matrix_dense cimport Matrix_dense + cdef class Matrix_numpy_dense(Matrix_dense): cdef object _numpy_dtype diff --git a/src/sage/matrix/matrix_numpy_dense.pyx b/src/sage/matrix/matrix_numpy_dense.pyx index d0e55fa927a..262c320197b 100644 --- a/src/sage/matrix/matrix_numpy_dense.pyx +++ b/src/sage/matrix/matrix_numpy_dense.pyx @@ -40,7 +40,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from .args cimport MatrixArgs_init +from sage.matrix.args cimport MatrixArgs_init cimport sage.structure.element cimport numpy as cnumpy diff --git a/src/sage/matrix/matrix_numpy_integer_dense.pxd b/src/sage/matrix/matrix_numpy_integer_dense.pxd index c74a2c7511c..3116f89d8e2 100644 --- a/src/sage/matrix/matrix_numpy_integer_dense.pxd +++ b/src/sage/matrix/matrix_numpy_integer_dense.pxd @@ -1,4 +1,4 @@ -from .matrix_numpy_dense cimport Matrix_numpy_dense +from sage.matrix.matrix_numpy_dense cimport Matrix_numpy_dense cdef class Matrix_numpy_integer_dense(Matrix_numpy_dense): diff --git a/src/sage/matrix/matrix_rational_dense.pxd b/src/sage/matrix/matrix_rational_dense.pxd index 64d2c646e51..6a6347f4926 100644 --- a/src/sage/matrix/matrix_rational_dense.pxd +++ b/src/sage/matrix/matrix_rational_dense.pxd @@ -1,5 +1,5 @@ from sage.libs.flint.types cimport fmpz_t, fmpq_mat_t -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense cdef class Matrix_rational_dense(Matrix_dense): cdef fmpq_mat_t _matrix diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 4f1e5e415e1..dd5118785bb 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -104,9 +104,9 @@ cimport sage.structure.element from sage.structure.richcmp cimport rich_to_bool from sage.rings.rational cimport Rational -from .matrix cimport Matrix -from .args cimport SparseEntry, MatrixArgs_init -from .matrix_integer_dense cimport Matrix_integer_dense, _lift_crt +from sage.matrix.matrix cimport Matrix +from sage.matrix.args cimport SparseEntry, MatrixArgs_init +from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense, _lift_crt from sage.structure.element cimport Element, Vector from sage.rings.integer cimport Integer from sage.rings.ring import is_Ring diff --git a/src/sage/matrix/matrix_rational_sparse.pxd b/src/sage/matrix/matrix_rational_sparse.pxd index 56ff6ff26a3..c754850bee9 100644 --- a/src/sage/matrix/matrix_rational_sparse.pxd +++ b/src/sage/matrix/matrix_rational_sparse.pxd @@ -1,6 +1,6 @@ from sage.libs.gmp.types cimport mpz_t from sage.modules.vector_rational_sparse cimport mpq_vector -from .matrix_sparse cimport Matrix_sparse +from sage.matrix.matrix_sparse cimport Matrix_sparse cdef class Matrix_rational_sparse(Matrix_sparse): diff --git a/src/sage/matrix/matrix_rational_sparse.pyx b/src/sage/matrix/matrix_rational_sparse.pyx index 497c58408b7..41dacbff1c7 100644 --- a/src/sage/matrix/matrix_rational_sparse.pyx +++ b/src/sage/matrix/matrix_rational_sparse.pyx @@ -35,8 +35,8 @@ from cpython.sequence cimport * from sage.rings.rational cimport Rational from sage.rings.integer cimport Integer -from .matrix cimport Matrix -from .args cimport SparseEntry, MatrixArgs_init +from sage.matrix.matrix cimport Matrix +from sage.matrix.args cimport SparseEntry, MatrixArgs_init from sage.libs.gmp.mpz cimport * from sage.libs.gmp.mpq cimport * @@ -51,8 +51,8 @@ cimport sage.structure.element import sage.matrix.matrix_space -from .matrix_integer_sparse cimport Matrix_integer_sparse -from .matrix_rational_dense cimport Matrix_rational_dense +from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse +from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense cdef class Matrix_rational_sparse(Matrix_sparse): diff --git a/src/sage/matrix/matrix_real_double_dense.pxd b/src/sage/matrix/matrix_real_double_dense.pxd index 3be163114c5..d0badf48240 100644 --- a/src/sage/matrix/matrix_real_double_dense.pxd +++ b/src/sage/matrix/matrix_real_double_dense.pxd @@ -1,4 +1,5 @@ -from .matrix_double_dense cimport Matrix_double_dense +from sage.matrix.matrix_double_dense cimport Matrix_double_dense + cdef class Matrix_real_double_dense(Matrix_double_dense): cdef set_unsafe_double(self, Py_ssize_t i, Py_ssize_t j, double value) noexcept diff --git a/src/sage/matrix/matrix_symbolic_dense.pxd b/src/sage/matrix/matrix_symbolic_dense.pxd index 9ae644a8815..aa85e4c6a21 100644 --- a/src/sage/matrix/matrix_symbolic_dense.pxd +++ b/src/sage/matrix/matrix_symbolic_dense.pxd @@ -1,4 +1,5 @@ -from .matrix_generic_dense cimport Matrix_generic_dense +from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense + cdef class Matrix_symbolic_dense(Matrix_generic_dense): pass diff --git a/src/sage/matrix/matrix_symbolic_dense.pyx b/src/sage/matrix/matrix_symbolic_dense.pyx index b4f6f4f748f..c926cde2500 100644 --- a/src/sage/matrix/matrix_symbolic_dense.pyx +++ b/src/sage/matrix/matrix_symbolic_dense.pyx @@ -157,7 +157,7 @@ Check that :trac:`12778` is fixed:: from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.factorization import Factorization -from .matrix_generic_dense cimport Matrix_generic_dense +from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense from .constructor import matrix cdef maxima diff --git a/src/sage/matrix/matrix_symbolic_sparse.pxd b/src/sage/matrix/matrix_symbolic_sparse.pxd index 897754c837d..c90e0161119 100644 --- a/src/sage/matrix/matrix_symbolic_sparse.pxd +++ b/src/sage/matrix/matrix_symbolic_sparse.pxd @@ -1,4 +1,5 @@ -from .matrix_generic_sparse cimport Matrix_generic_sparse +from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse + cdef class Matrix_symbolic_sparse(Matrix_generic_sparse): pass diff --git a/src/sage/matrix/matrix_symbolic_sparse.pyx b/src/sage/matrix/matrix_symbolic_sparse.pyx index 29f29a04dd1..766114a1a48 100644 --- a/src/sage/matrix/matrix_symbolic_sparse.pyx +++ b/src/sage/matrix/matrix_symbolic_sparse.pyx @@ -165,7 +165,7 @@ Check that :issue:`35653` is fixed:: from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.factorization import Factorization -from .matrix_generic_sparse cimport Matrix_generic_sparse +from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse from .constructor import matrix cdef maxima diff --git a/src/sage/matrix/matrix_window.pxd b/src/sage/matrix/matrix_window.pxd index 523f0d2b235..c33d5d16806 100644 --- a/src/sage/matrix/matrix_window.pxd +++ b/src/sage/matrix/matrix_window.pxd @@ -1,4 +1,5 @@ -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix + cdef class MatrixWindow: cdef Py_ssize_t _row, _col, _nrows, _ncols diff --git a/src/sage/matrix/misc.pyx b/src/sage/matrix/misc.pyx index 1819d45591e..9a51efc1038 100644 --- a/src/sage/matrix/misc.pyx +++ b/src/sage/matrix/misc.pyx @@ -18,9 +18,9 @@ from sage.modules.vector_rational_sparse cimport * from sage.rings.integer cimport Integer from sage.rings.rational_field import QQ -from .matrix0 cimport Matrix -from .matrix_integer_sparse cimport Matrix_integer_sparse -from .matrix_rational_sparse cimport Matrix_rational_sparse +from sage.matrix.matrix0 cimport Matrix +from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse +from sage.matrix.matrix_rational_sparse cimport Matrix_rational_sparse matrix_integer_dense_rational_reconstruction = \ LazyImport('sage.matrix.misc_flint', 'matrix_integer_dense_rational_reconstruction', diff --git a/src/sage/matrix/misc_flint.pyx b/src/sage/matrix/misc_flint.pyx index 37d326c9a74..d5ca017f73a 100644 --- a/src/sage/matrix/misc_flint.pyx +++ b/src/sage/matrix/misc_flint.pyx @@ -13,8 +13,8 @@ from sage.libs.flint.fmpz cimport fmpz_set_mpz, fmpz_one from sage.rings.integer cimport Integer from sage.rings.rational_field import QQ -from .matrix_integer_dense cimport Matrix_integer_dense -from .matrix_rational_dense cimport Matrix_rational_dense +from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense +from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense def matrix_integer_dense_rational_reconstruction(Matrix_integer_dense A, Integer N): diff --git a/src/sage/matrix/misc_mpfr.pyx b/src/sage/matrix/misc_mpfr.pyx index 48b6ade6379..91613b16492 100644 --- a/src/sage/matrix/misc_mpfr.pyx +++ b/src/sage/matrix/misc_mpfr.pyx @@ -9,7 +9,7 @@ cimport sage.rings.abc from sage.libs.mpfr cimport * from sage.rings.real_mpfr cimport RealNumber -from .matrix0 cimport Matrix +from sage.matrix.matrix0 cimport Matrix def hadamard_row_bound_mpfr(Matrix A): diff --git a/src/sage/matrix/strassen.pyx b/src/sage/matrix/strassen.pyx index 9e2797c9925..3d083fa6859 100644 --- a/src/sage/matrix/strassen.pyx +++ b/src/sage/matrix/strassen.pyx @@ -15,7 +15,7 @@ multiplication algorithms. # http://www.gnu.org/licenses/ #***************************************************************************** -from .matrix_window cimport MatrixWindow +from sage.matrix.matrix_window cimport MatrixWindow from cysignals.signals cimport sig_on, sig_off diff --git a/src/sage/matrix/template.pxd b/src/sage/matrix/template.pxd index 8c473730dd2..69123a38f2d 100644 --- a/src/sage/matrix/template.pxd +++ b/src/sage/matrix/template.pxd @@ -1,4 +1,5 @@ -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense + cdef class Matrix_generic_dense(Matrix_dense): pass diff --git a/src/sage/matroids/basis_exchange_matroid.pxd b/src/sage/matroids/basis_exchange_matroid.pxd index b762fd9ed9d..5877f62fc09 100644 --- a/src/sage/matroids/basis_exchange_matroid.pxd +++ b/src/sage/matroids/basis_exchange_matroid.pxd @@ -1,8 +1,8 @@ from sage.data_structures.bitset cimport * from sage.data_structures.bitset_base cimport bitset_t, bitset_s -from .matroid cimport Matroid -from .set_system cimport SetSystem +from sage.matroids.matroid cimport Matroid +from sage.matroids.set_system cimport SetSystem cdef class BasisExchangeMatroid(Matroid): cdef long _groundset_size, _matroid_rank, _bitset_size diff --git a/src/sage/matroids/basis_exchange_matroid.pyx b/src/sage/matroids/basis_exchange_matroid.pyx index c27a8cba33d..8940bbe5d93 100644 --- a/src/sage/matroids/basis_exchange_matroid.pyx +++ b/src/sage/matroids/basis_exchange_matroid.pyx @@ -38,8 +38,8 @@ Methods # https://www.gnu.org/licenses/ # **************************************************************************** -from .matroid cimport Matroid -from .set_system cimport SetSystem +from sage.matroids.matroid cimport Matroid +from sage.matroids.set_system cimport SetSystem from sage.data_structures.bitset_base cimport * diff --git a/src/sage/matroids/basis_matroid.pxd b/src/sage/matroids/basis_matroid.pxd index a4202bfedac..aeb59fdb66f 100644 --- a/src/sage/matroids/basis_matroid.pxd +++ b/src/sage/matroids/basis_matroid.pxd @@ -1,7 +1,7 @@ from sage.data_structures.bitset cimport bitset_t -from .matroid cimport Matroid -from .basis_exchange_matroid cimport BasisExchangeMatroid -from .set_system cimport SetSystem +from sage.matroids.matroid cimport Matroid +from sage.matroids.basis_exchange_matroid cimport BasisExchangeMatroid +from sage.matroids.set_system cimport SetSystem cdef class BasisMatroid(BasisExchangeMatroid): cdef bitset_t _bb diff --git a/src/sage/matroids/basis_matroid.pyx b/src/sage/matroids/basis_matroid.pyx index 93cf56ec60c..0610c9a1149 100644 --- a/src/sage/matroids/basis_matroid.pyx +++ b/src/sage/matroids/basis_matroid.pyx @@ -74,9 +74,9 @@ Methods from sage.data_structures.bitset_base cimport * from sage.structure.richcmp cimport rich_to_bool -from .matroid cimport Matroid -from .basis_exchange_matroid cimport BasisExchangeMatroid -from .set_system cimport SetSystem +from sage.matroids.matroid cimport Matroid +from sage.matroids.basis_exchange_matroid cimport BasisExchangeMatroid +from sage.matroids.set_system cimport SetSystem from cpython.object cimport Py_EQ, Py_NE from itertools import combinations diff --git a/src/sage/matroids/circuit_closures_matroid.pxd b/src/sage/matroids/circuit_closures_matroid.pxd index 1ec965db0fe..5f4edf109b7 100644 --- a/src/sage/matroids/circuit_closures_matroid.pxd +++ b/src/sage/matroids/circuit_closures_matroid.pxd @@ -1,4 +1,5 @@ -from .matroid cimport Matroid +from sage.matroids.matroid cimport Matroid + cdef class CircuitClosuresMatroid(Matroid): cdef frozenset _groundset # _E diff --git a/src/sage/matroids/circuit_closures_matroid.pyx b/src/sage/matroids/circuit_closures_matroid.pyx index 1fc11f0c344..bed582b98e8 100644 --- a/src/sage/matroids/circuit_closures_matroid.pyx +++ b/src/sage/matroids/circuit_closures_matroid.pyx @@ -67,8 +67,8 @@ Methods # **************************************************************************** from sage.structure.richcmp cimport rich_to_bool, richcmp -from .matroid cimport Matroid -from .set_system cimport SetSystem +from sage.matroids.matroid cimport Matroid +from sage.matroids.set_system cimport SetSystem from .utilities import setprint_s from cpython.object cimport Py_EQ, Py_NE diff --git a/src/sage/matroids/extension.pxd b/src/sage/matroids/extension.pxd index 34d813eeb7c..6b6d7949794 100644 --- a/src/sage/matroids/extension.pxd +++ b/src/sage/matroids/extension.pxd @@ -1,5 +1,5 @@ from sage.data_structures.bitset cimport bitset_t -from .basis_matroid cimport BasisMatroid +from sage.matroids.basis_matroid cimport BasisMatroid cdef class CutNode: cdef LinearSubclasses _MC diff --git a/src/sage/matroids/extension.pyx b/src/sage/matroids/extension.pyx index 061ba37089e..553869fcf66 100644 --- a/src/sage/matroids/extension.pyx +++ b/src/sage/matroids/extension.pyx @@ -30,7 +30,7 @@ Methods # **************************************************************************** from sage.data_structures.bitset_base cimport * -from .basis_matroid cimport BasisMatroid +from sage.matroids.basis_matroid cimport BasisMatroid cdef class CutNode: diff --git a/src/sage/matroids/linear_matroid.pxd b/src/sage/matroids/linear_matroid.pxd index 663886fa58e..c7e6a402494 100644 --- a/src/sage/matroids/linear_matroid.pxd +++ b/src/sage/matroids/linear_matroid.pxd @@ -1,8 +1,8 @@ from sage.data_structures.bitset cimport bitset_t -from .matroid cimport Matroid -from .basis_exchange_matroid cimport BasisExchangeMatroid -from .lean_matrix cimport LeanMatrix, GenericMatrix, BinaryMatrix, TernaryMatrix, QuaternaryMatrix +from sage.matroids.matroid cimport Matroid +from sage.matroids.basis_exchange_matroid cimport BasisExchangeMatroid +from sage.matroids.lean_matrix cimport LeanMatrix, GenericMatrix, BinaryMatrix, TernaryMatrix, QuaternaryMatrix cdef class LinearMatroid(BasisExchangeMatroid): diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index 51692e8f1c1..a1e0e412a5a 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -344,8 +344,8 @@ from sage.structure.sage_object cimport SageObject MixedIntegerLinearProgram = LazyImport('sage.numerical.mip', 'MixedIntegerLinearProgram') -from .lean_matrix cimport BinaryMatrix, TernaryMatrix -from .set_system cimport SetSystem +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 diff --git a/src/sage/matroids/union_matroid.pxd b/src/sage/matroids/union_matroid.pxd index 6e3a6e8d96e..a378cfe910d 100644 --- a/src/sage/matroids/union_matroid.pxd +++ b/src/sage/matroids/union_matroid.pxd @@ -1,4 +1,5 @@ -from .matroid cimport Matroid +from sage.matroids.matroid cimport Matroid + cdef class MatroidUnion(Matroid): cdef list matroids diff --git a/src/sage/matroids/union_matroid.pyx b/src/sage/matroids/union_matroid.pyx index 802b8d609f4..bb3dd03a082 100644 --- a/src/sage/matroids/union_matroid.pyx +++ b/src/sage/matroids/union_matroid.pyx @@ -1,5 +1,5 @@ -from .matroid cimport Matroid +from sage.matroids.matroid cimport Matroid cdef class MatroidUnion(Matroid): diff --git a/src/sage/matroids/unpickling.pyx b/src/sage/matroids/unpickling.pyx index 94464ecb9f0..92ca5800204 100644 --- a/src/sage/matroids/unpickling.pyx +++ b/src/sage/matroids/unpickling.pyx @@ -30,10 +30,10 @@ import sage.matroids.matroid import sage.matroids.basis_exchange_matroid from .minor_matroid import MinorMatroid from .dual_matroid import DualMatroid -from .circuit_closures_matroid cimport CircuitClosuresMatroid -from .basis_matroid cimport BasisMatroid -from .linear_matroid cimport LinearMatroid, RegularMatroid, BinaryMatroid, TernaryMatroid, QuaternaryMatroid -from .lean_matrix cimport GenericMatrix, BinaryMatrix, TernaryMatrix, QuaternaryMatrix, PlusMinusOneMatrix, RationalMatrix +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.rings.rational cimport Rational diff --git a/src/sage/modules/vector_complex_double_dense.pxd b/src/sage/modules/vector_complex_double_dense.pxd index f26526a1669..955c0a414d2 100644 --- a/src/sage/modules/vector_complex_double_dense.pxd +++ b/src/sage/modules/vector_complex_double_dense.pxd @@ -1,4 +1,5 @@ -from .vector_double_dense cimport Vector_double_dense +from sage.modules.vector_double_dense cimport Vector_double_dense + cdef class Vector_complex_double_dense(Vector_double_dense): pass diff --git a/src/sage/modules/vector_double_dense.pxd b/src/sage/modules/vector_double_dense.pxd index f29b4597d15..f4f1f47cbce 100644 --- a/src/sage/modules/vector_double_dense.pxd +++ b/src/sage/modules/vector_double_dense.pxd @@ -1,4 +1,5 @@ -from .vector_numpy_dense cimport Vector_numpy_dense +from sage.modules.vector_numpy_dense cimport Vector_numpy_dense + cdef class Vector_double_dense(Vector_numpy_dense): pass diff --git a/src/sage/modules/vector_integer_dense.pxd b/src/sage/modules/vector_integer_dense.pxd index 322a10c369b..0db4808be63 100644 --- a/src/sage/modules/vector_integer_dense.pxd +++ b/src/sage/modules/vector_integer_dense.pxd @@ -1,7 +1,8 @@ -from .free_module_element cimport FreeModuleElement from sage.libs.gmp.types cimport mpz_t +from sage.modules.free_module_element cimport FreeModuleElement from sage.structure.parent cimport Parent + cdef class Vector_integer_dense(FreeModuleElement): cdef mpz_t* _entries cdef int _init(self, Py_ssize_t degree, Parent parent) except -1 diff --git a/src/sage/modules/vector_modn_dense.pxd b/src/sage/modules/vector_modn_dense.pxd index 2482f999d37..6e726651ea1 100644 --- a/src/sage/modules/vector_modn_dense.pxd +++ b/src/sage/modules/vector_modn_dense.pxd @@ -1,5 +1,6 @@ -from .free_module_element cimport FreeModuleElement from sage.ext.mod_int cimport mod_int +from sage.modules.free_module_element cimport FreeModuleElement + cdef class Vector_modn_dense(FreeModuleElement): cdef mod_int* _entries @@ -8,4 +9,3 @@ cdef class Vector_modn_dense(FreeModuleElement): cdef _new_c(self) noexcept cdef _init(self, Py_ssize_t degree, parent, mod_int p) noexcept - diff --git a/src/sage/modules/vector_numpy_dense.pxd b/src/sage/modules/vector_numpy_dense.pxd index 6af57a997c5..0cb384222c2 100644 --- a/src/sage/modules/vector_numpy_dense.pxd +++ b/src/sage/modules/vector_numpy_dense.pxd @@ -1,6 +1,8 @@ -from .free_module_element cimport FreeModuleElement cimport numpy +from sage.modules.free_module_element cimport FreeModuleElement + + cdef class Vector_numpy_dense(FreeModuleElement): cdef object _numpy_dtype cdef int _numpy_dtypeint diff --git a/src/sage/modules/vector_numpy_integer_dense.pxd b/src/sage/modules/vector_numpy_integer_dense.pxd index e39b90bbcb9..31bc1cf8f6b 100644 --- a/src/sage/modules/vector_numpy_integer_dense.pxd +++ b/src/sage/modules/vector_numpy_integer_dense.pxd @@ -1,4 +1,5 @@ -from .vector_numpy_dense cimport Vector_numpy_dense +from sage.modules.vector_numpy_dense cimport Vector_numpy_dense + cdef class Vector_numpy_integer_dense(Vector_numpy_dense): diff --git a/src/sage/modules/vector_rational_dense.pxd b/src/sage/modules/vector_rational_dense.pxd index 1bcde479153..4820936580a 100644 --- a/src/sage/modules/vector_rational_dense.pxd +++ b/src/sage/modules/vector_rational_dense.pxd @@ -1,7 +1,8 @@ -from .free_module_element cimport FreeModuleElement from sage.libs.gmp.types cimport mpq_t +from sage.modules.free_module_element cimport FreeModuleElement from sage.structure.parent cimport Parent + cdef class Vector_rational_dense(FreeModuleElement): cdef mpq_t* _entries cdef int _init(self, Py_ssize_t degree, Parent parent) except -1 diff --git a/src/sage/modules/vector_real_double_dense.pxd b/src/sage/modules/vector_real_double_dense.pxd index 6f75ec0c4dd..4dd3b43ab25 100644 --- a/src/sage/modules/vector_real_double_dense.pxd +++ b/src/sage/modules/vector_real_double_dense.pxd @@ -1,5 +1,5 @@ -from .vector_double_dense cimport Vector_double_dense +from sage.modules.vector_double_dense cimport Vector_double_dense + cdef class Vector_real_double_dense(Vector_double_dense): pass - diff --git a/src/sage/stats/distributions/discrete_gaussian_integer.pxd b/src/sage/stats/distributions/discrete_gaussian_integer.pxd index 7235a9397f7..d6edbe88d43 100644 --- a/src/sage/stats/distributions/discrete_gaussian_integer.pxd +++ b/src/sage/stats/distributions/discrete_gaussian_integer.pxd @@ -1,8 +1,8 @@ -from .dgs cimport dgs_disc_gauss_mp_t, dgs_disc_gauss_dp_t - -from sage.structure.sage_object cimport SageObject -from sage.rings.real_mpfr cimport RealNumber from sage.rings.integer cimport Integer +from sage.rings.real_mpfr cimport RealNumber +from sage.stats.distributions.dgs cimport dgs_disc_gauss_mp_t, dgs_disc_gauss_dp_t +from sage.structure.sage_object cimport SageObject + cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): cdef readonly RealNumber sigma diff --git a/src/sage/stats/distributions/discrete_gaussian_integer.pyx b/src/sage/stats/distributions/discrete_gaussian_integer.pyx index 2aa28609180..6d50074102b 100644 --- a/src/sage/stats/distributions/discrete_gaussian_integer.pyx +++ b/src/sage/stats/distributions/discrete_gaussian_integer.pyx @@ -148,9 +148,9 @@ from sage.libs.mpfr cimport mpfr_set, MPFR_RNDN from sage.rings.integer cimport Integer from sage.misc.randstate cimport randstate, current_randstate -from .dgs cimport dgs_disc_gauss_mp_init, dgs_disc_gauss_mp_clear, dgs_disc_gauss_mp_flush_cache -from .dgs cimport dgs_disc_gauss_dp_init, dgs_disc_gauss_dp_clear, dgs_disc_gauss_dp_flush_cache -from .dgs cimport DGS_DISC_GAUSS_UNIFORM_TABLE, DGS_DISC_GAUSS_UNIFORM_ONLINE, DGS_DISC_GAUSS_UNIFORM_LOGTABLE, DGS_DISC_GAUSS_SIGMA2_LOGTABLE +from sage.stats.distributions.dgs cimport dgs_disc_gauss_mp_init, dgs_disc_gauss_mp_clear, dgs_disc_gauss_mp_flush_cache +from sage.stats.distributions.dgs cimport dgs_disc_gauss_dp_init, dgs_disc_gauss_dp_clear, dgs_disc_gauss_dp_flush_cache +from sage.stats.distributions.dgs cimport DGS_DISC_GAUSS_UNIFORM_TABLE, DGS_DISC_GAUSS_UNIFORM_ONLINE, DGS_DISC_GAUSS_UNIFORM_LOGTABLE, DGS_DISC_GAUSS_SIGMA2_LOGTABLE cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): r""" diff --git a/src/sage/stats/hmm/chmm.pyx b/src/sage/stats/hmm/chmm.pyx index aa35b8cefdc..fe09b3f9cfb 100644 --- a/src/sage/stats/hmm/chmm.pyx +++ b/src/sage/stats/hmm/chmm.pyx @@ -28,9 +28,9 @@ from sage.structure.element import is_Matrix from sage.stats.time_series cimport TimeSeries from sage.stats.intlist cimport IntList -from .hmm cimport HiddenMarkovModel -from .util cimport HMM_Util -from .distributions cimport GaussianMixtureDistribution +from sage.stats.hmm.hmm cimport HiddenMarkovModel +from sage.stats.hmm.util cimport HMM_Util +from sage.stats.hmm.distributions cimport GaussianMixtureDistribution cdef HMM_Util util = HMM_Util() diff --git a/src/sage/stats/hmm/hmm.pyx b/src/sage/stats/hmm/hmm.pyx index 86de50cc1a3..fe8ab69cc66 100644 --- a/src/sage/stats/hmm/hmm.pyx +++ b/src/sage/stats/hmm/hmm.pyx @@ -41,7 +41,7 @@ from sage.matrix.constructor import matrix from sage.misc.randstate cimport current_randstate, randstate from cpython.object cimport PyObject_RichCompare -from .util cimport HMM_Util +from sage.stats.hmm.util cimport HMM_Util cdef HMM_Util util = HMM_Util() From 35914d34905abcc5d8299b7ba8087217ce92ee5c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 30 Oct 2023 18:06:58 -0700 Subject: [PATCH 2/3] Replace relative imports in Cython files --- 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/modules/free_module_element.pyx | 10 +++--- src/sage/modules/vector_double_dense.pyx | 2 +- src/sage/modules/vector_numpy_dense.pyx | 2 +- 25 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/sage/matrix/action.pyx b/src/sage/matrix/action.pyx index 849163a511f..11e70f977bb 100644 --- a/src/sage/matrix/action.pyx +++ b/src/sage/matrix/action.pyx @@ -62,7 +62,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 bdb6eb796dd..58369f97803 100644 --- a/src/sage/matrix/args.pyx +++ b/src/sage/matrix/args.pyx @@ -982,7 +982,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) @@ -1113,7 +1113,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 536fe7bdf29..15b22b35f77 100644 --- a/src/sage/matrix/constructor.pyx +++ b/src/sage/matrix/constructor.pyx @@ -654,7 +654,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 d7a0487e6cd..d8c9f0b2809 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -47,7 +47,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() @@ -1750,7 +1750,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(): @@ -2051,7 +2051,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__ \ @@ -2135,7 +2135,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: @@ -2164,7 +2164,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: @@ -2375,7 +2375,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()]) ################################################### @@ -3850,7 +3850,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] @@ -3927,7 +3927,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) @@ -6178,7 +6178,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): @@ -6195,5 +6195,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 8af0889927f..6c02bc09e73 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 @@ -8802,7 +8802,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 @@ -8840,7 +8840,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) @@ -8879,7 +8879,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: @@ -15084,7 +15084,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 6a048a78edc..cb83823c576 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 @@ -1535,7 +1535,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 f4312a479e5..57d3517e6a9 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -70,7 +70,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 527ef1b48f6..a4d0615971d 100644 --- a/src/sage/matrix/matrix_generic_dense.pyx +++ b/src/sage/matrix/matrix_generic_dense.pyx @@ -8,7 +8,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 5fa8894c2a9..bd1f860c167 100644 --- a/src/sage/matrix/matrix_generic_sparse.pyx +++ b/src/sage/matrix/matrix_generic_sparse.pyx @@ -451,7 +451,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 26e2e766d30..5488177dae1 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -118,12 +118,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 @@ -1592,8 +1592,8 @@ cdef class Matrix_integer_dense(Matrix_dense): return Matrix_mod2_dense(MS, self, True, True) cdef _mod_int_c(self, mod_int p) noexcept: - 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 @@ -1626,8 +1626,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) @@ -2051,7 +2051,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: @@ -2098,7 +2098,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) @@ -2197,7 +2197,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): @@ -2235,7 +2235,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): @@ -3402,7 +3402,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, @@ -3766,7 +3766,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: @@ -4233,7 +4233,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(): @@ -4680,7 +4680,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 @@ -4879,7 +4879,7 @@ cdef class Matrix_integer_dense(Matrix_dense): """ cdef Py_ssize_t i, j, n = self._nrows, m = self._ncols - from .constructor import matrix + from sage.matrix.constructor import matrix # 0. Base case if self.nrows() == 0: @@ -5584,7 +5584,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 16e577e9b40..27f5cdfac0f 100644 --- a/src/sage/matrix/matrix_integer_sparse.pyx +++ b/src/sage/matrix/matrix_integer_sparse.pyx @@ -421,7 +421,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): @@ -1037,7 +1037,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(): @@ -1230,7 +1230,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 edcd75a1a77..b6d60d3d586 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -931,7 +931,7 @@ cdef class Matrix_modn_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(): @@ -1110,7 +1110,7 @@ cdef class Matrix_modn_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 dd5118785bb..8b72c9c56f2 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -114,7 +114,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 # ######################################################## @@ -1406,7 +1406,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() @@ -1473,7 +1473,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() @@ -1803,7 +1803,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 41dacbff1c7..fcdc75b43d1 100644 --- a/src/sage/matrix/matrix_rational_sparse.pyx +++ b/src/sage/matrix/matrix_rational_sparse.pyx @@ -583,7 +583,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 542638ed17d..5a41f75c832 100644 --- a/src/sage/matrix/matrix_real_double_dense.pyx +++ b/src/sage/matrix/matrix_real_double_dense.pyx @@ -60,7 +60,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 c926cde2500..e69d977a117 100644 --- a/src/sage/matrix/matrix_symbolic_dense.pyx +++ b/src/sage/matrix/matrix_symbolic_dense.pyx @@ -158,7 +158,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 766114a1a48..69c36e764fb 100644 --- a/src/sage/matrix/matrix_symbolic_sparse.pyx +++ b/src/sage/matrix/matrix_symbolic_sparse.pyx @@ -166,7 +166,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 8940bbe5d93..e5c18e0185b 100644 --- a/src/sage/matroids/basis_exchange_matroid.pyx +++ b/src/sage/matroids/basis_exchange_matroid.pyx @@ -2151,7 +2151,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 @@ -2217,7 +2217,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 bed582b98e8..0a25aee80cb 100644 --- a/src/sage/matroids/circuit_closures_matroid.pyx +++ b/src/sage/matroids/circuit_closures_matroid.pyx @@ -69,7 +69,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 a1e0e412a5a..ed971cb8349 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) noexcept: @@ -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 ** @@ -3610,8 +3610,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) @@ -3694,7 +3694,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 @@ -4009,7 +4009,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) noexcept: @@ -4505,7 +4505,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) noexcept: @@ -4564,7 +4564,7 @@ cdef class Matroid(SageObject): 5 """ - from . import extension + from sage.matroids import extension if element is None: element = newlabel(self.groundset()) else: @@ -7773,7 +7773,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): @@ -7882,7 +7882,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 @@ -8066,7 +8066,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: @@ -8116,7 +8116,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 92ca5800204..77b3f12265c 100644 --- a/src/sage/matroids/unpickling.pyx +++ b/src/sage/matroids/unpickling.pyx @@ -28,13 +28,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/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index a2c077cc8c8..ef37ffbc1c3 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -554,11 +554,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() @@ -566,7 +566,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() @@ -1831,7 +1831,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: @@ -5093,7 +5093,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 a47d91a7fdd..9977e91e15b 100644 --- a/src/sage/modules/vector_double_dense.pyx +++ b/src/sage/modules/vector_double_dense.pyx @@ -284,7 +284,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 fc14cc4829a..0c7a67dbbd5 100644 --- a/src/sage/modules/vector_numpy_dense.pyx +++ b/src/sage/modules/vector_numpy_dense.pyx @@ -29,7 +29,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() From 4370ea2c67f0dc78ea8b9b6665ed51dc166124bc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Sep 2023 22:16:45 -0700 Subject: [PATCH 3/3] Clean up cimports --- src/sage/matrix/matrix_modn_sparse.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index b6d60d3d586..2a399790ca3 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -108,6 +108,7 @@ from sage.matrix.args cimport SparseEntry, MatrixArgs_init from sage.matrix.matrix2 import Matrix as Matrix2 from sage.matrix.matrix_dense cimport Matrix_dense from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense +from sage.matrix.matrix_sparse cimport Matrix_sparse from sage.misc.verbose import verbose, get_verbose from sage.modules.vector_integer_dense cimport Vector_integer_dense from sage.modules.vector_integer_sparse cimport *