Previous topic

GfTools

Next topic

GfTools.pade

This Page

GfTools.matrix

The gftools.matrix module contains functions to work with Green’s functions in matrix form.

API

Functions to work with Green’s in matrix from.

In the limit of infinite coordination number the self-energy becomes local, inverse Green’s functions take the simple form:

\[ \begin{align}\begin{aligned}(G^{-1}(iω))_{ii} &= iω - μ_i - t_{ii} - Σ_i(iω)\\(G^{-1}(iω))_{ij} &= t_{ij} \quad \text{for } i ≠ j\end{aligned}\end{align} \]
class gftools.matrix.Decomposition(rv, xi, rv_inv)[source]

Abstraction for matrix decomposition designed for green’s functions.

This can be used as drop-in replacement for returning rv, xi, rv_inv. Additionally it offers methods to reconstruct that matrix. The intended use case is to use the Decomposition for the inversion of the Green’s function to calculate it from the resolvent.

rv

(N, N) complex np.ndarray – The matrix of right eigenvalues.

xi

(N, …) complex np.ndarray – The vector of eigenvalues

rv_inv

(N, N) complex np.ndarray – The inverse of rv.

apply(func, *args, **kwds)[source]

Modify self.xi according to func.

Simple wrapper to transform the eigenvalues self.xi.

reconstruct(xi=None, kind='full')[source]

Get matrix back from Decomposition.

If the reciprocal of self.xi was taken, this corresponds to the inverse of the original matrix. New axises can be appended to self.xi, however the 0th axis has to correspond to the matrix dimension.

Parameters:
  • xi ((N, ..) ndarray, optional) – Alternative value used for self.xi. This argument can be used instead of calling self.apply or modifying self.xi.
  • kind ({'diag', 'full'} or str) – Defines how to reconstruct the matrix. If kind is ‘diag’, only the diagonal elements are returned, if it is ‘full’ the complete matrix is returned. The start of the strings is also sufficient (e.g. kind = ‘f’). Alternatively as str used for np.einsum can be given.
Returns:

reconstruct – The reconstructed matrix.

Return type:

(N, N, ..) or (N, ..) ndarray

gftools.matrix.construct_gf_omega(rv, diag_inv, rv_inv)[source]

Construct Green’s function from decomposition of its inverse.

\[G^{−1} = P h P^{-1} ⇒ G = P h^{-1} P^{-1}\]
Parameters:
  • rv_inv ((N, N) complex ndarray) – The inverse of the matrix of right eigenvectors (\(P^{-1}\))
  • diag_inv – The eigenvalues (\(h\))
  • rv ((N, N) complex ndarray) – The matrix of right eigenvectors (\(P\))
Returns:

gf_omega – The Green’s function

Return type:

(N, N) complex ndarray

gftools.matrix.decompose_gf_omega(g_inv)[source]

Decompose the inverse Green’s function into eigenvalues and eigenvectors.

The similarity transformation:

\[G^{-1} = P h P^{-1}, \quad h = diag(λ(G))\]
Parameters:g_inv ((N, N) complex ndarray) – matrix to be decomposed
Returns:
  • Decomposition.rv_inv ((N, N) complex ndarray) – The inverse of the right eigenvectors \(P\)
  • Decomposition.h ((N) complex ndarray) – The complex eigenvalues of g_inv
  • Decomposition.rv ((N, N) complex ndarray) – The right eigenvectors \(P\)
gftools.matrix.decompose_hamiltonian(hamilton)[source]

Decompose the Hamiltonian matrix into eigenvalues and eigenvectors.

The similarity transformation:

\[H = U^\dagger h U^\dagger, \quad h = diag(λ(G))\]
Parameters:hamilton ((N, N) complex ndarray) – matrix to be decomposed
Returns:
  • Decomposition.rv_inv ((N, N) complex ndarray) – The inverse of the right eigenvectors \(U^†\). The Hamiltonian is hermitian, thus the decomposition is unitary \(U^† = U ^{-1}\)
  • Decomposition.h ((N) float ndarray) – The eigenvalues of hamilton
  • Decomposition.rv ((N, N) complex ndarray) – The right eigenvectors \(U\)