function stationary_distribution¶
- deeptime.markov.tools.analysis.stationary_distribution(T, ncv: Optional[int] = None, mode: str = 'fallback', check_inputs: bool = True)¶
Compute stationary distribution of stochastic matrix T.
- Parameters:
T ((M, M) ndarray or scipy.sparse matrix) – Transition matrix
ncv (int (optional)) – The number of Lanczos vectors generated, ncv must be greater than k; it is recommended that ncv > 2*k. Only relevant for sparse matrices and if backward iteration is unsuccessful.
mode (str, optional, default='fallback') – Determines whether the method first tries backward iteration and then eigenvector estimation (‘fallback’) or it uses backward iteration only (‘backward’) or it uses eigenvector estimation only (‘eigenvector’).
check_inputs (bool, optional, default=True) – Whether to check for connectivity and if it is a transition matrix.
- Returns:
mu – Vector of stationary probabilities.
- Return type:
(M,) ndarray
Notes
The stationary distribution \(\mu\) is the left eigenvector corresponding to the non-degenerate eigenvalue \(\lambda=1\),
\[\mu^T T =\mu^T. \]Examples
>>> import numpy as np >>> from deeptime.markov.tools.analysis import stationary_distribution
>>> T = np.array([[0.9, 0.1, 0.0], [0.4, 0.2, 0.4], [0.0, 0.1, 0.9]]) >>> mu = stationary_distribution(T) >>> mu array([0.44444444, 0.11111111, 0.44444444])