Skip to content

greens_function_solver#

Includes the Green's function solver classes.

Modules:

  • inv –

    Includes the selected inversion solver based on dense inversion.

  • rgf –

    Includes the selected inversion solver.

  • rgf_dist –

    Includes the distributed selected inversion solver.

  • solver –

    Includes the abstract base class for the Green's function solvers.

Classes:

  • Inv –

    Selected inversion solver based on dense matrix inversion.

  • RGF –

    Selected inversion solver based on the Schur complement.

  • RGFDist –

    Distributed selected inversion solver.

  • GFSolver –

    Abstract base class for the Green's function solvers.

Inv #

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.

Parameters:

  • max_batch_size (int, default: 100 ) –

    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.

selected_inv #

selected_inv(a: DSDBSparse, out: DSDBSparse, obc_blocks: OBCBlocks | None = None) -> None

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.

  • out (DSDBSparse) –

    Preallocated output matrix.

  • obc_blocks (OBCBlocks, default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions. By default None.

selected_solve #

selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, out: tuple[DSDBSparse, ...], obc_blocks: OBCBlocks | None = None, return_retarded: bool = False, callbacks: list[Callable] | None = None) -> None | 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}^*\).

  • out (tuple[DSDBSparse, ...]) –

    Preallocated output matrices

  • obc_blocks (OBCBlocks, default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • return_retarded (bool, default: False ) –

    Wether the retarded Green's function should be returned along with lesser and greater, by default False

  • callbacks (list[Callable], default: None ) –

    List of callback functions. Not supported in this solver.

RGF #

RGF(max_batch_size: int = 100)

Bases: GFSolver

Selected inversion solver based on the Schur complement.

Parameters:

  • max_batch_size (int, default: 100 ) –

    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.

selected_inv #

selected_inv(a: DSDBSparse, out: DSDBSparse, obc_blocks: OBCBlocks | None = None) -> None

Performs selected inversion of a block-tridiagonal matrix.

Parameters:

  • a (DSDBSparse) –

    Matrix to invert.

  • out (DSDBSparse) –

    Preallocated output matrix.

  • obc_blocks (OBCBlocks, default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions. By default None.

selected_solve #

selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, out: tuple[DSDBSparse, ...], obc_blocks: OBCBlocks | None = None, return_retarded: bool = False, callbacks: list[Callable] | None = None) -> None

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}^*\).

  • out (tuple[DSDBSparse, ...]) –

    Preallocated output matrices.

  • obc_blocks (OBCBlocks, default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions. By default None.

  • return_retarded (bool, default: False ) –

    Wether the retarded Green's function should be returned along with lesser and greater, by default False

  • callbacks (list[Callable], default: None ) –

    List of callback functions to be called during the back substitution step. Each callback function should accept a single argument of type BackwardSubstitutionContext, by default None.

RGFDist #

RGFDist(max_batch_size: int = 100)

Bases: GFSolver

Distributed selected inversion solver.

Parameters:

  • max_batch_size (int, default: 100 ) –

    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.

selected_inv #

selected_inv(a: DSDBSparse, out: DSDBSparse, obc_blocks: OBCBlocks | None = None) -> None

Performs selected inversion of a block-tridiagonal matrix.

Parameters:

  • a (DSDBSparse) –

    Matrix to invert.

  • out (DSDBSparse) –

    Preallocated output matrix.

  • obc_blocks (OBCBlocks, default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions. By default None.

selected_solve #

selected_solve(a: DSDBSparse | _DStackView, sigma_lesser: DSDBSparse | _DStackView, sigma_greater: DSDBSparse | _DStackView, out: tuple[DSDBSparse, ...] | tuple[_DStackView, ...], obc_blocks: OBCBlocks | None = None, return_retarded: bool = False, callbacks: list[Callable] | None = None) -> None

Performs selected inversion of a block-tridiagonal matrix.

Can optionally solve the quadratic system associated with the lesser and greater right-hand-sides.

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

  • obc_blocks (dict[int, OBCBlocks], default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions, by default None.

  • return_retarded (bool, default: False ) –

    Wether the retarded Green's function should be returned along with lesser and greater, by default False.

  • callbacks (list[Callable], default: None ) –

    List of callback functions to be called during the back substitution step. Each callback function should accept a single argument of type BackwardSubstitutionContext, by default None.

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.

selected_inv abstractmethod #

selected_inv(a: DSDBSparse, out: DSDBSparse, obc_blocks: OBCBlocks | None = None) -> None

Performs selected inversion of a block-tridiagonal matrix.

Parameters:

  • a (DSDBSparse) –

    Matrix to invert.

  • out (DSDBSparse) –

    Preallocated output matrix.

  • obc_blocks (OBCBlocks, default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions. By default None.

selected_solve abstractmethod #

selected_solve(a: DSDBSparse, sigma_lesser: DSDBSparse, sigma_greater: DSDBSparse, out: tuple[DSDBSparse, ...], obc_blocks: OBCBlocks | None = None, return_retarded: bool = False, callbacks: list[Callable[[BackSubstitutionContext], None]] | None = None) -> None

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}^*\).

  • out (tuple[DSDBSparse, ...]) –

    Preallocated output matrices

  • obc_blocks (dict[int, OBCBlocks], default: None ) –

    OBC blocks for lesser, greater and retarded Green's functions, by default None.

  • return_retarded (bool, default: False ) –

    Wether the retarded Green's function should be returned along with lesser and greater, by default False

  • callbacks (list[Callable], default: None ) –

    List of callback functions to be called during the back substitution step. Each callback function should accept a single argument of type BackwardSubstitutionContext, by default None.