diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index 03e60d56394..dc3a2b651a6 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -514,6 +514,9 @@ cdef class Matrix_modn_dense_template(Matrix_dense): sage: Matrix(Integers(4618990), 2, 2, [-1, int(-2), GF(7)(-3), 1/7]) # needs sage.rings.finite_rings [4618989 4618988] [ 4 2639423] + + sage: Matrix(IntegerModRing(200), [[int(2**128+1), int(2**256+1), int(2**1024+1)]]) # needs sage.rings.finite_rings + [ 57 137 17] """ ma = MatrixArgs_init(parent, entries) cdef long i, j @@ -525,10 +528,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): se = t x = se.entry v = self._matrix[se.i] - if type(x) is int: - tmp = (x) % p - v[se.j] = tmp + (tmp<0)*p - elif type(x) is IntegerMod_int and (x)._parent is R: + if type(x) is IntegerMod_int and (x)._parent is R: v[se.j] = (x).ivalue elif type(x) is Integer: if coerce: