Skip to content

Commit

Permalink
sage-2453: Disable linbox as the default algorithm for mod p charpoly…
Browse files Browse the repository at this point in the history
… and minpoly because they are broken.
  • Loading branch information
williamstein committed Mar 11, 2008
1 parent 48922fd commit 34a789d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/sage/matrix/matrix_modn_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,17 @@ cdef class Matrix_modn_dense(matrix_dense.Matrix_dense):
########################################################################


def charpoly(self, var='x', algorithm='linbox'):
def charpoly(self, var='x', algorithm='generic'):
"""
Returns the characteristic polynomial of self.
INPUT:
INPUT:
var -- a variable name
algorithm -- 'linbox' (default if self.base_ring() is a field)
'generic'
algorithm -- 'generic' (default)
'linbox'
NOTE: 'linbox' sometimes segfaults, so it is not the default.
See trac 2453.
EXAMPLES:
sage: A = Mat(GF(7),3,3)(range(3)*3)
Expand All @@ -444,14 +447,18 @@ cdef class Matrix_modn_dense(matrix_dense.Matrix_dense):
self.cache('charpoly_%s_%s'%(algorithm, var), g)
return g

def minpoly(self, var='x', algorithm='linbox'):
def minpoly(self, var='x', algorithm='generic'):
"""
Returns the minimal polynomial of self.
INPUT:
var -- a variable name
algorithm -- 'linbox' (default if self.base_ring() is a field)
'generic'
algorithm -- 'generic' (default)
'linbox'
NOTE: 'linbox' sometimes segfaults, so it is not the default.
See trac 2453.
"""
if algorithm == 'linbox' and (self.p == 2 or not self.base_ring().is_field()):
algorithm='generic' #LinBox only supports fields
Expand Down

0 comments on commit 34a789d

Please sign in to comment.