Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix_integer_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
sig_on()
linbox_fmpz_mat_charpoly(g._poly, self._matrix)
sig_off()
if g.lc() == 1:
if g.lc() == 1 and g.degree() == self._nrows:
break
elif algorithm == 'generic':
g = Matrix_dense.charpoly(self, var)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix_integer_sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse):
fmpz_poly_set_coeff_mpz(g._poly, i, tmp)
_fmpz_poly_set_length(g._poly, p.size())

if g.lc() == 1:
if g.lc() == 1 and g.degree() == self._nrows:
break

del M
Expand Down
Loading