gftool.matrix.UDecomposition

class gftool.matrix.UDecomposition(rv: np.ndarray, eig: np.ndarray, rv_inv: np.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
u

Unitary matrix of right eigenvectors, same as rv.

uh

Hermitian conjugate of unitary matrix rv, same as rv_inv.

s

Singular values in descending order, different from order of eig.

__init__(rv: np.ndarray, eig: np.ndarray, rv_inv: np.ndarray)None

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(rv, eig, rv_inv)

Initialize self.

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

eig

The vector of eigenvalues.

rv

The matrix of right eigenvectors.

rv_inv

The inverse of rv.

s

Singular values in descending order, different from order of eig.

u

Unitary matrix of right eigenvectors, same as rv.

uh

Hermitian conjugate of unitary matrix rv, same as rv_inv.