added a method to convert the matrix into a stochastic matrix