opt.rank function

Finds the optimal rank for non-negative matrix factorization (NMF)