def convertToRateMatrix(self, Q):
        """
        Converts the initial matrix to a rate matrix.
        We make all rows in Q sum to zero by subtracting the row sums from the diagonal.
        """
        rowSums             = Q.sum(axis=1).getA1()
        idxRange            = np.arange(Q.shape[0])
        Qdiag               = coo_matrix((rowSums,(idxRange,idxRange)),shape=Q.shape).tocsr()
        return Q-Qdiag
def convertToRateMatrix ( self , Q ) : rowSums = Q . sum ( axis = 1 ) . getA1 ( ) idxRange = np . arange ( Q . shape [ 0 ] ) Qdiag = coo_matrix ( ( rowSums , ( idxRange , idxRange ) ) , shape = Q . shape ) . tocsr ( ) return Q - Qdiag
Converts the initial matrix to a rate matrix.
        We make all rows in Q sum to zero by subtracting the row sums from the diagonal.