Skip to content

qttools.greens_function_solver#

source package qttools.greens_function_solver

Classes

  • GFSolver Abstract base class for the Green's function solvers.

  • Inv Selected inversion solver based on dense matrix inversion.

  • RGF Selected inversion solver based on the Schur complement.

  • RGFDist Distributed selected inversion solver.

source class GFSolver()

Bases : ABC

Abstract base class for the Green's function solvers.

Methods

  • selected_inv Performs selected inversion of a block-tridiagonal matrix.

  • selected_solve Produces elements of the solution to the congruence equation.

source method GFSolver.selected_inv(a: DSDBSparse, obc_blocks: OBCBlocks | None = None, out: DSDBSparse = None)None | DSDBSparse

Performs selected inversion of a block-tridiagonal matrix.

Parameters

  • a : DSDBSparse Matrix to invert.

  • obc_blocks : OBCBlocks, optional OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • out : DSDBSparse, optional Preallocated output matrix, by default None.

Returns

  • None | DSDBSparse If out is None, returns None. Otherwise, returns the inverted matrix as a DSDBSparse object.

source method GFSolver.selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, obc_blocks: OBCBlocks | None = None, out: tuple | None = None, return_retarded: bool = False, return_current: bool = False)None | tuple

Produces elements of the solution to the congruence equation.

This method produces selected elements of the solution to the relation:

\[ X^{\lessgtr} = A^{-1} \Sigma^{\lessgtr} A^{-\dagger} \]

Parameters

  • a : DSDBSparse Matrix to invert.

  • sigma_lesser : DSDBSparse Lesser matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • sigma_greater : DSDBSparse Greater matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • obc_blocks : dict[int, OBCBlocks], optional OBC blocks for lesser, greater and retarded Green's functions, by default None.

  • out : tuple[DSDBSparse, ...] | None, optional Preallocated output matrices, by default None

  • return_retarded : bool, optional Wether the retarded Green's function should be returned along with lesser and greater, by default False

  • return_current : bool, optional Whether to compute and return the current for each layer via the Meir-Wingreen formula. By default False.

Returns

  • None | tuple If out is None, returns None. Otherwise, the solutions are returned as DSBParse matrices. If return_retarded is True, returns a tuple with the retarded Green's function as the last element.

source class Inv(max_batch_size: int = 100)

Bases : GFSolver

Selected inversion solver based on dense matrix inversion.

Warning

This solver will densify the matrix to invert it. It is intended as a reference implementation and should not be used in production code.

Initializes the selected inversion solver.

Parameters

  • max_batch_size : int, optional Maximum batch size to use when inverting the matrix, by default 100.

Methods

  • selected_inv Performs selected inversion of a block-tridiagonal matrix.

  • selected_solve Produces elements of the solution to the congruence equation.

source method Inv.selected_inv(a: DSDBSparse, obc_blocks: OBCBlocks | None = None, out: DSDBSparse | None = None)None | DSDBSparse

Performs selected inversion of a block-tridiagonal matrix.

This method will densify the matrix, invert it, and then select the elements to keep by matching the sparse structure of the input matrix.

Parameters

  • a : DSDBSparse Matrix to invert.

  • obc_blocks : OBCBlocks, optional OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • out : DSDBSparse, optional Preallocated output matrix, by default None.

Returns

  • None | DSDBSparse If out is None, returns None. Otherwise, returns the inverted matrix as a DSDBSparse object.

source method Inv.selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, obc_blocks: OBCBlocks | None = None, out: tuple[DSDBSparse, ...] | None = None, return_retarded: bool = False, return_current: bool = False)None | tuple

Produces elements of the solution to the congruence equation.

This method produces selected elements of the solution to the relation:

\[ X^{\lessgtr} = A^{-1} \Sigma^{\lessgtr} A^{-\dagger} \]

Parameters

  • a : DSDBSparse Matrix to invert.

  • sigma_lesser : DSDBSparse Lesser matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • sigma_greater : DSDBSparse Greater matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • obc_blocks : OBCBlocks, optional OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • out : tuple[DSDBSparse, ...] | None, optional Preallocated output matrices, by default None

  • return_retarded : bool, optional Wether the retarded Green's function should be returned along with lesser and greater, by default False

  • return_current : bool, optional Whether to compute and return the current for each layer via the Meir-Wingreen formula. By default False. This option is not implemented.

Returns

  • None | tuple If out is None, returns None. Otherwise, the solutions are returned as DSBParse matrices. If return_retarded is True, returns a tuple with the retarded Green's function as the last element.

Raises

  • NotImplementedError

  • ValueError

source class RGF(max_batch_size: int = 100)

Bases : GFSolver

Selected inversion solver based on the Schur complement.

Initializes the selected inversion solver.

Parameters

  • max_batch_size : int, optional Maximum batch size to use when inverting the matrix, by default 100.

Methods

  • selected_inv Performs selected inversion of a block-tridiagonal matrix.

  • selected_solve Produces elements of the solution to the congruence equation.

source method RGF.selected_inv(a: DSDBSparse, obc_blocks: OBCBlocks | None = None, out: DSDBSparse | None = None)None | DSDBSparse

Performs selected inversion of a block-tridiagonal matrix.

Parameters

  • a : DSDBSparse Matrix to invert.

  • obc_blocks : OBCBlocks, optional OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • out : DSDBSparse, optional Preallocated output matrix, by default None.

Returns

  • None | DSDBSparse If out is None, returns None. Otherwise, returns the inverted matrix as a DSDBSparse object.

source method RGF.selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, obc_blocks: OBCBlocks | None = None, out: tuple[DSDBSparse, ...] | None = None, return_retarded: bool = False, return_current: bool = False)None | tuple | NDArray

Produces elements of the solution to the congruence equation.

This method produces selected elements of the solution to the relation:

\[ X^{\lessgtr} = A^{-1} \Sigma^{\lessgtr} A^{-\dagger} \]

Parameters

  • a : DSDBSparse Matrix to invert.

  • sigma_lesser : DSDBSparse Lesser matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • sigma_greater : DSDBSparse Greater matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • obc_blocks : OBCBlocks, optional OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • out : tuple[DSDBSparse, ...] | None, optional Preallocated output matrices, by default None

  • return_retarded : bool, optional Wether the retarded Green's function should be returned along with lesser and greater, by default False

  • return_current : bool, optional Whether to compute and return the current for each layer via the Meir-Wingreen formula. By default False.

Returns

  • None | tuple | NDArray If out is None, returns None. Otherwise, the solutions are returned as DSBParse matrices. If return_retarded is True, returns a tuple with the retarded Green's function as the last element. If return_current is True, returns the current for each layer.

Raises

  • ValueError

source class RGFDist(max_batch_size: int = 100)

Bases : GFSolver

Distributed selected inversion solver.

Initializes the selected inversion solver.

Parameters

  • solve_lesser : bool, optional Whether to solve the quadratic system associated with the lesser right-hand-side, by default False.

  • solve_greater : bool, optional Whether to solve the quadratic system associated with the greater right-hand-side, by default False.

  • max_batch_size : int, optional Maximum batch size to use when inverting the matrix, by default 100.

Methods

  • selected_inv Performs selected inversion of a block-tridiagonal matrix.

  • selected_solve Performs selected inversion of a block-tridiagonal matrix.

source method RGFDist.selected_inv(a: DSDBSparse, out: DSDBSparse, obc_blocks: OBCBlocks | None = None)None | DSDBSparse

Performs selected inversion of a block-tridiagonal matrix.

Parameters

  • a : DSDBSparse Matrix to invert.

  • out : DSDBSparse, optional Preallocated output matrix, by default None.

Returns

  • None | DSDBSparse If out is None, returns None. Otherwise, returns the inverted matrix as a DSDBSparse object.

source method RGFDist.selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, out: tuple[DSDBSparse, ...], obc_blocks: OBCBlocks | None = None, return_retarded: bool = False)

Performs selected inversion of a block-tridiagonal matrix.

Can optionally solve the quadratic system associated with the Bl and Bg matrices in the equation AXA^T = B.

Parameters

  • a : DSDBSparse Matrix to invert.

  • sigma_lesser : DSDBSparse Lesser matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • sigma_greater : DSDBSparse Greater matrix. This matrix is expected to be skew-hermitian, i.e. \(\Sigma_{ij} = -\Sigma_{ji}^*\).

  • out : tuple[DSDBSparse, ...] Preallocated output matrices, by default None

  • obc_blocks : OBCBlocks, optional OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • return_retarded : bool, optional Wether the retarded Green's function should be returned along with lesser and greater, by default False

Raises

  • ValueError