gftool.matrix.Decomposition
- class gftool.matrix.Decomposition(rv: ndarray, eig: ndarray, rv_inv: ndarray)[source]
Decomposition of a matrix into eigenvalues and eigenvectors.
\[M = P Λ P^{-1}, Λ = diag(λ₀, λ₁, …)\]This class holds the eigenvalues and eigenvectors of the decomposition of a matrix and offers methods to reconstruct it. One intended use case is to use the
Decomposition
for the inversion of the Green’s function to calculate it from the resolvent.The order of the attributes is always rv, eig, rv_inv, as this gives the reconstruct of the matrix: mat = (rv * eig) @ rv_inv
- Parameters:
- rv(…, N, N) complex np.ndarray
The matrix of right eigenvectors.
- eig(…, N) complex np.ndarray
The vector of eigenvalues.
- rv_inv(…, N, N) complex np.ndarray
The inverse of
rv
.
Examples
Perform the eigendecomposition:
>>> matrix = np.random.random((10, 10)) >>> dec = gt.matrix.decompose_mat(matrix) >>> np.allclose(matrix, dec.reconstruct()) True
Inversion of matrix
>>> matrix_inv = dec.reconstruct(eig=1.0/dec.eig) >>> np.allclose(np.linalg.inv(matrix), matrix_inv) True
Methods
__init__
(rv, eig, rv_inv)count
(value)from_gf
(gf)Decompose the inverse Green's function matrix.
from_hamiltonian
(hamilton)Decompose the Hamiltonian matrix.
index
(value, [start, [stop]])Raises ValueError if the value is not present.
reconstruct
([eig, kind])Get matrix back from
Decomposition
.Attributes
The matrix of right eigenvectors.
The vector of eigenvalues.
The inverse of
rv
.