Skip to content

Commit 8b52cc3

Browse files
author
Release Manager
committed
sagemathgh-36594: Replace relative imports by absolute ones in `sage.{matrix,matroids,modules,stats}` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Cherry-picked from sagemath#35095 - This is for sagemath#36228 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36594 Reported by: Matthias Köppe Reviewer(s): David Coudert, Matthias Köppe
2 parents a717ac0 + 4370ea2 commit 8b52cc3

File tree

83 files changed

+220
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+220
-201
lines changed

src/sage/matrix/action.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ AUTHOR:
6262

6363
import operator
6464

65-
from .matrix_space import MatrixSpace, is_MatrixSpace
65+
from sage.matrix.matrix_space import MatrixSpace, is_MatrixSpace
6666
from sage.modules.free_module import FreeModule, is_FreeModule
6767
from sage.structure.coerce cimport coercion_model
6868
from sage.categories.homset import Hom, End

src/sage/matrix/args.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ cdef class MatrixArgs:
983983
if self.space is None:
984984
global MatrixSpace
985985
if MatrixSpace is None:
986-
from .matrix_space import MatrixSpace
986+
from sage.matrix.matrix_space import MatrixSpace
987987
self.space = MatrixSpace(self.base, self.nrows, self.ncols,
988988
sparse=self.sparse, **self.kwds)
989989

@@ -1114,7 +1114,7 @@ cdef class MatrixArgs:
11141114
if not (e.flags.c_contiguous is True or e.flags.f_contiguous is True):
11151115
raise TypeError('numpy matrix must be either c_contiguous or f_contiguous')
11161116

1117-
from .constructor import matrix
1117+
from sage.matrix.constructor import matrix
11181118
from sage.rings.real_double import RDF
11191119
from sage.rings.complex_double import CDF
11201120

src/sage/matrix/change_ring.pyx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Functions for changing the base ring of matrices quickly
33
"""
44

5-
from .matrix_space import MatrixSpace
6-
from .matrix_real_double_dense cimport Matrix_real_double_dense
7-
from .matrix_integer_dense cimport Matrix_integer_dense
5+
from sage.matrix.matrix_space import MatrixSpace
6+
from sage.matrix.matrix_real_double_dense cimport Matrix_real_double_dense
7+
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
88

99
from sage.rings.real_double import RDF
1010

src/sage/matrix/constructor.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ General matrix Constructor and display options
1414
# http://www.gnu.org/licenses/
1515
#*****************************************************************************
1616

17-
from .args cimport MatrixArgs
17+
from sage.matrix.args cimport MatrixArgs
1818
from sage.structure.global_options import GlobalOptions
1919

2020

@@ -654,7 +654,7 @@ def matrix(*args, **kwds):
654654
Matrix = matrix
655655

656656

657-
from .special import *
657+
from sage.matrix.special import *
658658

659659

660660
@matrix_method

src/sage/matrix/matrix.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .matrix2 cimport Matrix
1+
from sage.matrix.matrix2 cimport Matrix

src/sage/matrix/matrix0.pyx

+10-10
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ from sage.rings.integer_ring import is_IntegerRing
4747

4848
import sage.modules.free_module
4949

50-
from .matrix_misc import row_iterator
50+
from sage.matrix.matrix_misc import row_iterator
5151

5252
_Fields = Fields()
5353
_IntegralDomains = IntegralDomains()
@@ -1750,7 +1750,7 @@ cdef class Matrix(sage.structure.element.Matrix):
17501750
100 x 100 dense matrix over Integer Ring]
17511751
17521752
"""
1753-
from .constructor import options
1753+
from sage.matrix.constructor import options
17541754
if self._nrows <= options.max_rows() and self._ncols <= options.max_cols():
17551755
return self.str()
17561756
if self.is_sparse():
@@ -2051,7 +2051,7 @@ cdef class Matrix(sage.structure.element.Matrix):
20512051

20522052
# only use floating point formatting for inexact types that have
20532053
# custom implementation of __format__
2054-
from .constructor import options
2054+
from sage.matrix.constructor import options
20552055
prec = options.precision()
20562056
if prec is None or callable(rep_mapping) or not entries \
20572057
or type(entries[0]).__format__ is Element.__format__ \
@@ -2135,7 +2135,7 @@ cdef class Matrix(sage.structure.element.Matrix):
21352135
-0.35104242112828943 0.5084492941557279]
21362136
-0.9541798283979341 -0.8948790563276592]
21372137
"""
2138-
from .constructor import options
2138+
from sage.matrix.constructor import options
21392139
if self._nrows <= options.max_rows() and self._ncols <= options.max_cols():
21402140
return self.str(character_art=True)
21412141
else:
@@ -2164,7 +2164,7 @@ cdef class Matrix(sage.structure.element.Matrix):
21642164
sage: unicode_art(A)
21652165
100 x 100 dense matrix over Integer Ring
21662166
"""
2167-
from .constructor import options
2167+
from sage.matrix.constructor import options
21682168
if self._nrows <= options.max_rows() and self._ncols <= options.max_cols():
21692169
return self.str(unicode=True, character_art=True)
21702170
else:
@@ -2375,7 +2375,7 @@ cdef class Matrix(sage.structure.element.Matrix):
23752375
[ 5 25]
23762376
[125 625]
23772377
"""
2378-
from .constructor import matrix
2378+
from sage.matrix.constructor import matrix
23792379
return matrix(self.nrows(), self.ncols(), [e(*args, **kwargs) for e in self.list()])
23802380

23812381
###################################################
@@ -3850,7 +3850,7 @@ cdef class Matrix(sage.structure.element.Matrix):
38503850
raise ValueError("length of v must be at most the number of rows of self")
38513851
if not self._nrows:
38523852
return self.parent().row_space().zero_vector()
3853-
from .constructor import matrix
3853+
from sage.matrix.constructor import matrix
38543854
v = matrix(list(v)+[0]*(self._nrows-len(v)))
38553855
return (v * self)[0]
38563856

@@ -3927,7 +3927,7 @@ cdef class Matrix(sage.structure.element.Matrix):
39273927
raise ValueError("length of v must be at most the number of columns of self")
39283928
if not self._ncols:
39293929
return self.parent().column_space().zero_vector()
3930-
from .constructor import matrix
3930+
from sage.matrix.constructor import matrix
39313931
v = matrix(self._ncols, 1, list(v)+[0]*(self._ncols-len(v)))
39323932
return (self * v).column(0)
39333933

@@ -6178,7 +6178,7 @@ def set_max_rows(n):
61786178
"""
61796179
from sage.misc.superseded import deprecation
61806180
deprecation(30552, "'set_max_rows' is replaced by 'matrix.options.max_rows'")
6181-
from .constructor import options
6181+
from sage.matrix.constructor import options
61826182
options.max_rows = n-1
61836183

61846184
def set_max_cols(n):
@@ -6195,5 +6195,5 @@ def set_max_cols(n):
61956195
"""
61966196
from sage.misc.superseded import deprecation
61976197
deprecation(30552, "'set_max_cols' is replaced by 'matrix.options.max_cols'")
6198-
from .constructor import options
6198+
from sage.matrix.constructor import options
61996199
options.max_cols = n-1

src/sage/matrix/matrix1.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .matrix0 cimport Matrix as Matrix0
1+
from sage.matrix.matrix0 cimport Matrix as Matrix0
22

33
cdef class Matrix(Matrix0):
44
cdef _stack_impl(self, bottom) noexcept

src/sage/matrix/matrix2.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Generic matrices
1212
# http://www.gnu.org/licenses/
1313
#*****************************************************************************
1414

15-
from .matrix1 cimport Matrix as Matrix1
15+
from sage.matrix.matrix1 cimport Matrix as Matrix1
1616

1717
cdef class Matrix(Matrix1):
1818
cdef _det_by_minors(self, Py_ssize_t level) noexcept

src/sage/matrix/matrix2.pyx

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ from sage.arith.numerical_approx cimport digits_to_bits
9999
from copy import copy
100100

101101
import sage.modules.free_module
102-
from . import berlekamp_massey
102+
from sage.matrix import berlekamp_massey
103103
from sage.modules.free_module_element import is_FreeModuleElement
104104
from sage.matrix.matrix_misc import permanental_minor_polynomial
105105

@@ -8832,7 +8832,7 @@ cdef class Matrix(Matrix1):
88328832
output_window = output.matrix_window()
88338833

88348834

8835-
from . import strassen
8835+
from sage.matrix import strassen
88368836
strassen.strassen_window_multiply(output_window, self_window, right_window, cutoff)
88378837
return output
88388838

@@ -8870,7 +8870,7 @@ cdef class Matrix(Matrix1):
88708870
self._echelon_in_place_classical()
88718871
return
88728872

8873-
from . import strassen
8873+
from sage.matrix import strassen
88748874
pivots = strassen.strassen_echelon(self.matrix_window(), cutoff)
88758875
self.cache('pivots', pivots)
88768876
verbose('done with strassen', tm)
@@ -8909,7 +8909,7 @@ cdef class Matrix(Matrix1):
89098909
...
89108910
IndexError: matrix window index out of range
89118911
"""
8912-
from . import matrix_window
8912+
from sage.matrix import matrix_window
89138913
if nrows == -1:
89148914
nrows = self._nrows - row
89158915
if ncols == -1:
@@ -15117,7 +15117,7 @@ cdef class Matrix(Matrix1):
1511715117
except (OverflowError, TypeError):
1511815118
from sage.rings.real_mpfr import RealField
1511915119
# Try using MPFR, which handles large numbers much better, but is slower.
15120-
from .misc_mpfr import hadamard_row_bound_mpfr
15120+
from sage.matrix.misc_mpfr import hadamard_row_bound_mpfr
1512115121
R = RealField(53, rnd='RNDU')
1512215122
A = self.change_ring(R)
1512315123
m1 = hadamard_row_bound_mpfr(A)

src/sage/matrix/matrix_complex_ball_dense.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from sage.libs.arb.types cimport acb_mat_t
2-
from .matrix_dense cimport Matrix_dense
2+
from sage.matrix.matrix_dense cimport Matrix_dense
33
from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense
44
from sage.structure.parent cimport Parent
55

src/sage/matrix/matrix_complex_ball_dense.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ from sage.libs.arb.acb cimport *
4040
from sage.libs.arb.acb_mat cimport *
4141
from sage.libs.gmp.mpz cimport mpz_fits_ulong_p, mpz_get_ui
4242
from sage.matrix.constructor import matrix
43-
from .args cimport SparseEntry, MatrixArgs_init
43+
from sage.matrix.args cimport SparseEntry, MatrixArgs_init
4444
from sage.rings.complex_interval cimport ComplexIntervalFieldElement
4545
from sage.rings.complex_arb cimport (
4646
ComplexBall,
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .matrix_double_dense cimport Matrix_double_dense
1+
from sage.matrix.matrix_double_dense cimport Matrix_double_dense
22

33
cdef class Matrix_complex_double_dense(Matrix_double_dense):
44
pass

src/sage/matrix/matrix_cyclo_dense.pxd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sage.libs.gmp.types cimport mpz_t
2-
from .matrix_dense cimport Matrix_dense
3-
from .matrix_rational_dense cimport Matrix_rational_dense
2+
from sage.matrix.matrix_dense cimport Matrix_dense
3+
from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense
44

55
cdef class Matrix_cyclo_dense(Matrix_dense):
66

src/sage/matrix/matrix_cyclo_dense.pyx

+8-8
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ from sage.libs.flint.fmpz cimport fmpz_init, fmpz_clear, fmpz_set_mpz, fmpz_one,
5656
from sage.libs.flint.fmpq cimport fmpq_is_zero, fmpq_set_mpq, fmpq_canonicalise
5757
from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry_num, fmpq_mat_entry_den, fmpq_mat_entry
5858

59-
from .args cimport MatrixArgs_init
60-
from .constructor import matrix
61-
from .matrix_space import MatrixSpace
62-
from .matrix cimport Matrix
63-
from . import matrix_dense
64-
from .matrix_integer_dense cimport _lift_crt
59+
from sage.matrix.args cimport MatrixArgs_init
60+
from sage.matrix.constructor import matrix
61+
from sage.matrix.matrix_space import MatrixSpace
62+
from sage.matrix.matrix cimport Matrix
63+
from sage.matrix import matrix_dense
64+
from sage.matrix.matrix_integer_dense cimport _lift_crt
6565
from sage.structure.element cimport Matrix as baseMatrix
66-
from .misc_flint import matrix_integer_dense_rational_reconstruction
66+
from sage.matrix.misc_flint import matrix_integer_dense_rational_reconstruction
6767

6868
from sage.arith.misc import binomial, previous_prime
6969
from sage.rings.rational_field import QQ
@@ -1535,7 +1535,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense):
15351535
K = self.base_ring()
15361536
phi = K.defining_polynomial()
15371537
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
1538-
from .constructor import matrix
1538+
from sage.matrix.constructor import matrix
15391539
F = GF(p)
15401540
aa = [a for a, _ in phi.change_ring(F).roots()]
15411541
n = K.degree()

src/sage/matrix/matrix_dense.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .matrix cimport Matrix
1+
from sage.matrix.matrix cimport Matrix
22

33
cdef class Matrix_dense(Matrix):
44
cdef void set_unsafe_int(self, Py_ssize_t i, Py_ssize_t j, int value) noexcept
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .matrix cimport Matrix
1+
from sage.matrix.matrix cimport Matrix
22

33
cdef class Matrix_domain_dense(Matrix):
44
pass
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .matrix cimport Matrix
1+
from sage.matrix.matrix cimport Matrix
22

33
cdef class Matrix_domain_sparse(Matrix):
44
pass

src/sage/matrix/matrix_double_dense.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .matrix_numpy_dense cimport Matrix_numpy_dense
1+
from sage.matrix.matrix_numpy_dense cimport Matrix_numpy_dense
22

33

44
cdef class Matrix_double_dense(Matrix_numpy_dense):

src/sage/matrix/matrix_double_dense.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import sage.rings.real_double
7070
import sage.rings.complex_double
7171

7272
from sage.structure.element cimport Vector
73-
from .constructor import matrix
73+
from sage.matrix.constructor import matrix
7474
cimport sage.structure.element
7575

7676
cimport numpy as cnumpy
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from .matrix_generic_sparse cimport Matrix_generic_sparse
1+
from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse
2+
23

34
cdef class Matrix_double_sparse(Matrix_generic_sparse):
45
pass

src/sage/matrix/matrix_double_sparse.pyx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from .matrix2 cimport Matrix
2-
from .matrix_generic_sparse cimport Matrix_generic_sparse
1+
from sage.matrix.matrix2 cimport Matrix
2+
from sage.matrix.matrix_generic_sparse cimport Matrix_generic_sparse
3+
34

45
cdef class Matrix_double_sparse(Matrix_generic_sparse):
56
r"""

src/sage/matrix/matrix_gap.pxd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from .matrix_dense cimport Matrix_dense
1+
from sage.matrix.matrix_dense cimport Matrix_dense
22
from sage.libs.gap.element cimport GapElement
33

4+
45
cdef class Matrix_gap(Matrix_dense):
56
cdef GapElement _libgap
67

78
cpdef GapElement gap(self) noexcept
89
cdef Matrix_gap _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept
9-

src/sage/matrix/matrix_gap.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Wrappers on GAP matrices
1313

1414
from sage.libs.gap.libgap import libgap
1515
from sage.structure.element cimport Matrix
16-
from .args cimport MatrixArgs_init
16+
from sage.matrix.args cimport MatrixArgs_init
1717

1818

1919
cdef class Matrix_gap(Matrix_dense):

src/sage/matrix/matrix_generic_dense.pxd

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from .matrix_dense cimport Matrix_dense
1+
from sage.matrix.matrix_dense cimport Matrix_dense
2+
23

34
cdef class Matrix_generic_dense(Matrix_dense):
45
cdef list _entries

src/sage/matrix/matrix_generic_dense.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ from cpython.number cimport *
88
from cpython.ref cimport *
99

1010
cimport sage.matrix.matrix_dense as matrix_dense
11-
from . import matrix_dense
12-
from .args cimport MatrixArgs_init
11+
from sage.matrix import matrix_dense
12+
from sage.matrix.args cimport MatrixArgs_init
1313

1414
cimport sage.matrix.matrix as matrix
1515

src/sage/matrix/matrix_generic_sparse.pxd

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from .matrix_sparse cimport Matrix_sparse
1+
from sage.matrix.matrix_sparse cimport Matrix_sparse
2+
23

34
cdef class Matrix_generic_sparse(Matrix_sparse):
45
cdef dict _entries

src/sage/matrix/matrix_generic_sparse.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ EXAMPLES::
5555
"""
5656
cimport sage.matrix.matrix_sparse as matrix_sparse
5757
cimport sage.structure.element
58-
from .args cimport MatrixArgs_init
58+
from sage.matrix.args cimport MatrixArgs_init
5959

6060

6161
cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse):
@@ -451,7 +451,7 @@ def Matrix_sparse_from_rows(X):
451451
if not X:
452452
raise ArithmeticError("X must be nonempty")
453453

454-
from . import matrix_space
454+
from sage.matrix import matrix_space
455455
entries = {}
456456
R = X[0].base_ring()
457457
ncols = X[0].degree()

src/sage/matrix/matrix_gf2e_dense.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sage.libs.m4rie cimport mzed_t
22
from sage.libs.m4ri cimport m4ri_word
3-
from .matrix_dense cimport Matrix_dense
3+
from sage.matrix.matrix_dense cimport Matrix_dense
44

55

66
cdef class Matrix_gf2e_dense(Matrix_dense):

0 commit comments

Comments
 (0)