I am running Sagemath 9.1 on macOS 10.15.17
but I think this issue is more about math.
Consider the following code
G = GL(2^8, GF(2^8))
A = G.random_element()
B = Matrix(A)
%time B.is_invertible()
C = Matrix(A)
%time C.nrows() == C.ncols() == C.rank()
The first timer returns 9s while the second timer returns 2ms.
I believe that this is because
- is_invertible() computes charpoly and read off the det.
This is a detour when the base ring is a field. - rank() uses m4rie, which uses asymptotically fast algorithm for rref.
Perhaps we can add one more if-brach in is_invertible() that exploits fast rref?