egttools.utils.calculate_stationary_distribution_non_hermitian¶
- calculate_stationary_distribution_non_hermitian(transition_matrix)[source]¶
Calculates the stationary distribution of a Markov chain using a Schur decomposition.
Produces the same result as
calculate_stationary_distribution(); the Schur decomposition is more numerically stable than a full eigendecomposition for ill-conditioned dense matrices.The matrix must be column-stochastic (each column sums to 1), i.e. the transpose of the row-stochastic matrices returned by
calculate_transition_matrix. PassT.T. Sparse input is kept sparse and solved as incalculate_stationary_distribution().- Parameters:
transition_matrix (
Union[ndarray,spmatrix,sparray]) – A 2 dimensional, column-stochastic transition matrix.- Returns:
A 1-dimensional vector containing the stationary distribution
- Return type:
- Warns:
RuntimeWarning – If some transition probability is close to 1, or if eigenvalue 1 is not simple (the chain has no unique stationary distribution).