Skip to content

Commit

Permalink
Clean up cimports
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 8, 2023
1 parent 7d04241 commit ef2f651
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
1 change: 0 additions & 1 deletion src/sage/algebras/quatalg/quaternion_algebra_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Check that :trac:`20829` is fixed::

from sage.structure.element cimport AlgebraElement, Element
from sage.structure.richcmp cimport rich_to_bool, rich_to_bool_sgn, richcmp_item
from sage.algebras.quatalg.quaternion_algebra_element cimport QuaternionAlgebraElement_abstract
from sage.rings.rational cimport Rational
from sage.rings.integer cimport Integer
from sage.rings.number_field.number_field_element cimport NumberFieldElement
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/flint/fmpz_poly.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ from sage.arith.long cimport pyobject_to_long
from sage.cpython.string cimport char_to_str, str_to_bytes
from sage.structure.sage_object cimport SageObject
from sage.rings.integer cimport Integer
from sage.libs.flint.fmpz_poly cimport *


cdef class Fmpz_poly(SageObject):

Expand Down
39 changes: 24 additions & 15 deletions src/sage/matrix/matrix_modn_sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,27 @@ from sage.ext.stdsage cimport PY_NEW

from sage.libs.flint.fmpz cimport fmpz_get_mpz, fmpz_set_mpz
from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry
from sage.libs.gmp.mpz cimport mpz_set

from sage.modules.vector_modn_sparse cimport *

cimport sage.libs.linbox.givaro as givaro
cimport sage.libs.linbox.linbox as linbox

from sage.libs.linbox.conversion cimport *

from sage.matrix.matrix2 cimport Matrix
cimport sage.matrix.matrix as matrix
cimport sage.matrix.matrix_sparse as matrix_sparse
cimport sage.matrix.matrix_dense as matrix_dense
from sage.libs.linbox.conversion cimport (get_method,
METHOD_DEFAULT,
METHOD_DENSE_ELIMINATION,
METHOD_SPARSE_ELIMINATION,
METHOD_BLACKBOX,
METHOD_WIEDEMANN,
ERROR,
new_linbox_matrix_modn_sparse,
new_linbox_matrix_integer_sparse,
new_linbox_vector_integer_dense,
new_sage_vector_integer_dense)

from sage.matrix.matrix_sparse cimport Matrix_sparse
from sage.matrix.matrix_dense cimport Matrix_dense
from sage.rings.finite_rings.integer_mod cimport IntegerMod_int, IntegerMod_abstract
from sage.rings.integer cimport Integer
from sage.rings.rational_field import QQ
Expand All @@ -114,14 +123,14 @@ from sage.matrix.matrix2 import Matrix as Matrix2
from sage.matrix.args cimport SparseEntry, MatrixArgs_init
from sage.arith.misc import is_prime

cimport sage.structure.element

from sage.data_structures.binary_search cimport *
from sage.modules.vector_integer_sparse cimport *

from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
from sage.modules.vector_integer_dense cimport Vector_integer_dense

from sage.structure.element cimport Matrix

################
# TODO: change this to use extern cdef's methods.
from sage.rings.fast_arith cimport arith_int
Expand All @@ -134,7 +143,7 @@ ai = arith_int()
# Github Issue #12679.
MAX_MODULUS = 46341

cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
cdef class Matrix_modn_sparse(Matrix_sparse):
def __cinit__(self):
nr = self._nrows
nc = self._ncols
Expand Down Expand Up @@ -258,7 +267,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
else:
raise ValueError("unknown matrix format")

cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right):
cdef Matrix _matrix_times_matrix_(self, Matrix _right):
"""
This code is implicitly called for multiplying self by another
sparse matrix.
Expand Down Expand Up @@ -337,7 +346,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
set_entry(&ans.rows[i], j, s)
return ans

def _matrix_times_matrix_dense(self, sage.structure.element.Matrix _right):
def _matrix_times_matrix_dense(self, Matrix _right):
"""
Multiply self by the sparse matrix _right, and return the
result as a dense matrix.
Expand All @@ -362,7 +371,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
<class 'sage.matrix.matrix_mod2_dense.Matrix_mod2_dense'>
"""
cdef Matrix_modn_sparse right
cdef matrix_dense.Matrix_dense ans
cdef Matrix_dense ans
right = _right

cdef c_vector_modint* v
Expand Down Expand Up @@ -872,7 +881,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
self.cache('det', d)
return d
elif algorithm == 'generic':
d = matrix_sparse.Matrix_sparse.determinant(self)
d = Matrix_sparse.determinant(self)
self.cache('det', d)
return d
else:
Expand Down Expand Up @@ -950,7 +959,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
if algorithm == "generic":
return Matrix_sparse.solve_right(self, B)
else:
if isinstance(B, sage.structure.element.Matrix):
if isinstance(B, Matrix):
from sage.matrix.special import diagonal_matrix
m, d = self._solve_matrix_linbox(B, algorithm)
return m * diagonal_matrix([QQ((1,x)) for x in d])
Expand Down Expand Up @@ -1122,7 +1131,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse):
from sage.modules.free_module_element import vector

cdef Matrix_integer_dense B
if not isinstance(mat, Matrix):
if not isinstance(mat, Matrix2):
B = <Matrix_integer_dense?> matrix(ZZ, mat, sparse=False)
else:
B = <Matrix_integer_dense?> mat.change_ring(ZZ).dense_matrix()
Expand Down
2 changes: 0 additions & 2 deletions src/sage/modules/vector_modn_sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

from cysignals.memory cimport sig_malloc, sig_free

from sage.modules.vector_modn_sparse cimport c_vector_modint


cdef int allocate_c_vector_modint(c_vector_modint* v, Py_ssize_t num_nonzero) except -1:
"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/rings/complex_mpc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2563,4 +2563,3 @@ cdef class CCtoMPC(Map):

# Support Python's numbers abstract base class
# import numbers
from sage.rings.complex_mpc import MPComplexNumber
1 change: 0 additions & 1 deletion src/sage/rings/ring_extension.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# sage_setup: distribution = sagemath-modules
from sage.categories.map cimport Map
from sage.rings.ring cimport CommutativeRing, CommutativeAlgebra
from sage.rings.ring_extension cimport RingExtension_generic


cdef class RingExtension_generic(CommutativeAlgebra):
Expand Down
3 changes: 0 additions & 3 deletions src/sage/symbolic/constants_c_impl.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ The constant `e`
# http://www.gnu.org/licenses/
#*****************************************************************************

from sage.symbolic.expression cimport Expression


# keep exp(1) for fast access
# this is initialized in the constructor of the class E below to prevent
# circular imports while loading the library
Expand Down

0 comments on commit ef2f651

Please sign in to comment.