1 | initial version |

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
[0]
sage: M.inverse()
[1]
```

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

- https://github.com/malb/m4rie/blob/9f39ae950a733bd1e9ced74f59d9b594f5a7296c/src/newton_john.c#L508

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.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.