msmtools.analysis.rdl_decomposition¶
-
msmtools.analysis.
rdl_decomposition
(T, k=None, norm='auto', ncv=None, reversible=False, mu=None)¶ Compute the decomposition into eigenvalues, left and right eigenvectors.
Parameters: - T ((M, M) ndarray or sparse matrix) – Transition matrix
- k (int (optional)) – Number of eigenvector/eigenvalue pairs
- norm ({'standard', 'reversible', 'auto'}, optional) –
which normalization convention to use
norm ‘standard’ LR = Id, is a probabilitydistribution, the stationary distributionof T. Right eigenvectors Rhave a 2-norm of 1 ‘reversible’ R and L are related via L[0, :]*R
‘auto’ reversible if T is reversible, else standard. - ncv (int (optional)) – The number of Lanczos vectors generated, ncv must be greater than k; it is recommended that ncv > 2*k
- reversible (bool, optional) – Indicate that transition matrix is reversible
- mu ((M,) ndarray, optional) – Stationary distribution of T
Returns: - R ((M, M) ndarray) – The normalized (“unit length”) right eigenvectors, such that the
column
R[:,i]
is the right eigenvector corresponding to the eigenvaluew[i]
,dot(T,R[:,i])``=``w[i]*R[:,i]
- D ((M, M) ndarray) – A diagonal matrix containing the eigenvalues, each repeated according to its multiplicity
- L ((M, M) ndarray) – The normalized (with respect to R) left eigenvectors, such that the
row
L[i, :]
is the left eigenvector corresponding to the eigenvaluew[i]
,dot(L[i, :], T)``=``w[i]*L[i, :]
Examples
>>> import numpy as np >>> from msmtools.analysis import rdl_decomposition
>>> T = np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]]) >>> R, D, L = rdl_decomposition(T)
Matrix with right eigenvectors as columns
>>> R array([[ 1.00000000e+00, 1.04880885e+00, 3.16227766e-01], ...
Diagonal matrix with eigenvalues
>>> D array([[ 1.0+0.j, 0.0+0.j, 0.0+0.j], [ 0.0+0.j, 0.9+0.j, 0.0+0.j], [ 0.0+0.j, 0.0+0.j, -0.1+0.j]])
Matrix with left eigenvectors as rows
>>> L # +doctest: +ELLIPSIS array([[ 4.54545455e-01, 9.09090909e-02, 4.54545455e-01], ...