diff --git a/src/sage/matrix/__init__.py b/src/sage/matrix/__init__.py index 58b5ef12b66..e69de29bb2d 100644 --- a/src/sage/matrix/__init__.py +++ b/src/sage/matrix/__init__.py @@ -1,2 +0,0 @@ -# Resolve a cyclic import -import sage.matrix.args diff --git a/src/sage/matrix/args.pyx b/src/sage/matrix/args.pyx index bf4692ad726..82e0ba58571 100644 --- a/src/sage/matrix/args.pyx +++ b/src/sage/matrix/args.pyx @@ -20,7 +20,8 @@ from cysignals.signals cimport sig_check from cypari2.gen cimport Gen from cypari2.types cimport typ, t_MAT, t_VEC, t_COL, t_VECSMALL, t_LIST, t_STR, t_CLOSURE -from .matrix_space import MatrixSpace +MatrixSpace = None + from sage.rings.integer_ring import ZZ from sage.rings.real_double import RDF from sage.rings.complex_double import CDF @@ -931,6 +932,9 @@ cdef class MatrixArgs: self.sparse = (self.typ & MA_FLAG_SPARSE) != 0 if self.space is None: + global MatrixSpace + if MatrixSpace is None: + from .matrix_space import MatrixSpace self.space = MatrixSpace(self.base, self.nrows, self.ncols, sparse=self.sparse, **self.kwds) diff --git a/src/sage/matrix/matrix_mod2_dense.pyx b/src/sage/matrix/matrix_mod2_dense.pyx index be2ba45a5d2..faa3860907a 100644 --- a/src/sage/matrix/matrix_mod2_dense.pyx +++ b/src/sage/matrix/matrix_mod2_dense.pyx @@ -118,7 +118,7 @@ from sage.libs.gmp.random cimport * from sage.misc.randstate cimport randstate, current_randstate from sage.misc.misc import cputime from sage.misc.verbose import verbose, get_verbose -from sage.modules.free_module import VectorSpace +VectorSpace = None from sage.modules.vector_mod2_dense cimport Vector_mod2_dense from sage.structure.richcmp cimport rich_to_bool from sage.cpython.string cimport bytes_to_str, char_to_str, str_to_bytes @@ -507,6 +507,9 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse return self.rows(copy=False)[i] cdef Py_ssize_t j cdef Vector_mod2_dense z = Vector_mod2_dense.__new__(Vector_mod2_dense) + global VectorSpace + if VectorSpace is None: + from sage.modules.free_module import VectorSpace z._init(self._ncols, VectorSpace(self.base_ring(),self._ncols)) if self._ncols: mzd_submatrix(z._entries, self._entries, i, 0, i+1, self._ncols) @@ -600,6 +603,9 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) """ cdef mzd_t *tmp + global VectorSpace + if VectorSpace is None: + from sage.modules.free_module import VectorSpace VS = VectorSpace(self._base_ring, self._nrows) if not isinstance(v, Vector_mod2_dense): v = VS(v)