add an argument to get the rank with damped pseudo inverse