add function and fix function 'Rank' bug

The original function Rank for solving diagonal matrix of zero Gaussian
evaluation appears less than the true worth