Skip to content

Commit 1f4d2ac

Browse files
committed
Workaround for linbox charpoly/minpoly issues, take 2
1 parent f4adc25 commit 1f4d2ac

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sage/matrix/matrix_integer_dense.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
14161416
sig_on()
14171417
linbox_fmpz_mat_charpoly(g._poly, self._matrix)
14181418
sig_off()
1419-
if g.lc() == 1:
1419+
if g.lc() == 1 and g.degree() == self._nrows:
14201420
break
14211421
elif algorithm == 'generic':
14221422
g = Matrix_dense.charpoly(self, var)

src/sage/matrix/matrix_integer_sparse.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse):
912912
fmpz_poly_set_coeff_mpz(g._poly, i, tmp)
913913
_fmpz_poly_set_length(g._poly, p.size())
914914

915-
if g.lc() == 1:
915+
if g.lc() == 1 and g.degree() == self._nrows:
916916
break
917917

918918
del M

0 commit comments

Comments
 (0)