The Perron-Frobenius part is completely rewritten without the use of Eigen. The convergence of the Perron-Frobenius eigenvector seems extremely fast, much faster than a general eigenvalue search with Eigen. The only caveat is that I am not exactly sure that simply checking that the difference of two consecutive iterates becomes small enough is a good stopping condition. In general it is not, but in the Perron-Frobenius case it seems acceptable, because at least a big power of the Perron-Frobenius matrix is definitely a contraction of the set of unit vectors with strictly positive entries.