rank_cpp function

Rank of a matrix