For what it's worth, matlab's rank function just calls svd, and returns the number singular values greater than a tolerance.  The implementation is a whopping 5 lines long.

On 2/10/06, Fernando Perez <Fernando.Perez@colorado.edu> wrote:
Since numpy is a n-dimensional array package, it may be convenient to
introduce a matrix_rank() routine which does what matlab's rank() for 2-d
arrays and matrices, while raising an error for any other shape.  This would
also make it explicit that this operation is only well-defined for 2-d objects.

Or put it in numpy.linalg, which also makes it pretty clear what the scope is.

--bb