The rank command computes the rank of a matrix A. An optional second argument P specifies the modulus.
rank([[1,2],[1,-1]]); 2 rank([[1,2],[1,-1]],3); 1