msmtools.analysis.eigenvectors

msmtools.analysis.eigenvectors(T, k=None, right=True, ncv=None, reversible=False, mu=None)

Compute eigenvectors of given transition matrix.

Parameters:
  • T (numpy.ndarray, shape(d,d) or scipy.sparse matrix) – Transition matrix (stochastic matrix)
  • k (int (optional)) – Compute the first k eigenvectors
  • ncv (int (optional)) – The number of Lanczos vectors generated, ncv must be greater than k; it is recommended that ncv > 2*k
  • right (bool, optional) – If right=True compute right eigenvectors, left eigenvectors otherwise
  • reversible (bool, optional) – Indicate that transition matrix is reversible
  • mu ((M,) ndarray, optional) – Stationary distribution of T
Returns:

eigvec – The eigenvectors of T ordered with decreasing absolute value of the corresponding eigenvalue. If k is None then n=d, if k is int then n=k.

Return type:

numpy.ndarray, shape=(d, n)

Notes

Eigenvectors are computed using the scipy interface to the corresponding LAPACK/ARPACK routines.

If reversible=False, the returned eigenvectors \(v_i\) are normalized such that

\[\langle v_i, v_i \rangle = 1\]

This is the case for right eigenvectors \(r_i\) as well as for left eigenvectors \(l_i\).

If you desire orthonormal left and right eigenvectors please use the rdl_decomposition method.

If reversible=True the the eigenvectors of the similar symmetric matrix sqrt(mu_i / mu_j) p_{ij} will be used to compute the eigenvectors of T.

The precomputed stationary distribution will only be used if reversible=True.

Examples

>>> import numpy as np
>>> from msmtools.analysis import eigenvectors
>>> T = np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]])
>>> R = eigenvectors(T)

Matrix with right eigenvectors as columns

>>> R 
array([[  5.77350269e-01,   7.07106781e-01,   9.90147543e-02], ...