Ask Your Question

Revision history [back]

Thanks for reporting this bug here and on Sage Trac:

To analyse the error coming from:

sage: M = Matrix([0], ring=GF(4))
sage: M
sage: M.inverse()

we can check the documentation and the source code for the inverse method of M:

sage: M.inverse?
sage: M.inverse??

and we see that it calls ~M. In Sage, ~M calls M.__invert__().

The source code for the __invert__ method revealed by

sage: M.__invert__??

involves mzed_invert_newton_john from m4rie.

The source code for that function is at


and it echelonizes the augmented matrix to compute the inverse --- a fine thing to do for an invertible matrix.

There is now a fix at the Sage Trac ticket. After the fix, we first check whether the matrix has full rank; if not, we raise an error; if yes, we compute the inverse by echelonizing the augmented matrix.