Computing the degrees of freedom of rank-regularized estimators and cousins