Added rank() to matrices

Gives the rank of a matrix via rref.