gftool.matrix.UDecomposition
- class gftool.matrix.UDecomposition(rv: ndarray, eig: ndarray, rv_inv: ndarray)[source]
Unitary decomposition of a matrix into eigenvalues and eigenvectors.
\[H = U Λ U^†, Λ = 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
UDecomposition
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) float np.ndarray
The vector of real eigenvalues.
- rv_inv(…, N, N) complex np.ndarray
The inverse of
rv
.
Examples
Perform the eigendecomposition:
>>> matrix = np.random.random((10, 10)) + 1j*np.random.random((10, 10)) >>> matrix = 0.5*(matrix + matrix.conj().T) >>> dec = gt.matrix.decompose_her(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
The similarity transformation is unitary:
>>> np.allclose(dec.u.conj().T, dec.uh) True >>> np.allclose(dec.u @ dec.u.conj().T, np.eye(*matrix.shape)) True
- Attributes:
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 vector of eigenvalues.
The matrix of right eigenvectors.
The inverse of
rv
.Singular values in descending order, different from order of
eig
.Unitary matrix of right eigenvectors, same as
rv
.