function stationary_distribution

deeptime.markov.tools.analysis.stationary_distribution(T, ncv: int | None = None, mode: str = 'fallback', check_inputs: bool = True, tol: float = 1e-12)

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.

  • tol (float, optional, default=1e-12) – the tolerance of the sum of each row/column of the input matrix to tell if P 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 λ=1\lambda=1,

μTT=μT.\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])