|
TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
|
Lazy expression templates and arithmetic operations on Green's functions.
Arithmetic on Green's functions is lazy: an expression such as g1 + g2 or 2 * g does not compute a new Green's function immediately. Instead it builds a lightweight expression node (triqs::gfs::gf_expr for binary operations, triqs::gfs::gf_unary_m_expr for the unary minus) that models the GreenFunction concept and is only evaluated element by element when the expression is assigned to a container or accessed. This fuses chained operations and avoids intermediate temporaries.
The operators are generated by macros, so they do not appear individually in the member list below. The complete set of supported operations is, with g, g1, g2 Green's functions and s a scalar (an integer, real or complex number):
Binary operators (build a lazy triqs::gfs::gf_expr):
Unary operator:
Compound assignment (in-place, defined for both triqs::gfs::gf and triqs::gfs::gf_view and implemented as g = g OP x):
In-place operations with a matrix or scalar:
Compatibility rules enforced when combining two Green's functions:
Block Green's functions (triqs::gfs::block_gf) support the analogous set of arithmetic operations, applied block by block.
Classes | |
| struct | triqs::gfs::bgf_expr< Tag, L, R > |
| Lazy expression node representing a binary operation between two block Green's function operands. More... | |
| struct | triqs::gfs::bgf_unary_m_expr< L > |
| Lazy expression node representing the unary minus of a block Green's function operand. More... | |
| struct | triqs::gfs::gf_expr< Tag, L, R > |
| Lazy expression node representing a binary operation between two Green's function operands. More... | |
| struct | triqs::gfs::gf_unary_m_expr< L > |
| Lazy expression node representing the unary minus of a Green's function operand. More... | |
| struct | triqs::gfs::is_gf_expr< T > |
| Trait to detect whether a type is a Green's function expression node. More... | |
Functions | |
| template<typename M> | |
| gf< M, matrix_valued > | triqs::gfs::inverse (gf< M, matrix_valued > g) |
| Return the matrix inverse of a matrix-valued Green's function (inverts the target matrix at each mesh point). | |
| template<typename M> | |
| gf< M, matrix_valued > | triqs::gfs::inverse (gf_const_view< M, matrix_valued > g) |
| template<typename M> | |
| gf< M, matrix_valued > | triqs::gfs::inverse (gf_view< M, matrix_valued > g) |
| template<typename M> | |
| void | triqs::gfs::invert_in_place (gf_view< M, matrix_valued > g) |
| Invert, in place, the target matrix at each mesh point of a matrix-valued Green's function. | |
| template<typename M, typename T> | |
| gf< M, matrix_valued > | triqs::gfs::operator* (gf< M, matrix_valued > g, matrix< T > r) |
| Right-multiply a matrix-valued Green's function by a matrix at every mesh point. | |
| template<typename M, typename T> | |
| gf< M, matrix_valued > | triqs::gfs::operator* (matrix< T > l, gf< M, matrix_valued > g) |
| Left-multiply a matrix-valued Green's function by a matrix at every mesh point. | |
| template<Mesh M> | |
| void | triqs::gfs::operator+= (gf_view< M > g, dcomplex a) |
| In-place addition of a scalar (times the identity) to a matrix-valued Green's function. | |
| template<Mesh M, nda::MemoryMatrix Mat> | |
| void | triqs::gfs::operator+= (gf_view< M > g, Mat const &mat) |
| In-place addition of a matrix to every mesh point of a matrix-valued Green's function. | |
| template<Mesh M> | |
| void | triqs::gfs::operator+= (gf_view< M, scalar_valued > g, dcomplex a) |
| In-place addition of a scalar to a scalar-valued Green's function. | |
|
template<typename A1> requires (BlockGreenFunction<A1>::value) | |
| auto | triqs::gfs::operator- (A1 &&a1) |
| Unary minus operator returning a lazy triqs::gfs::bgf_unary_m_expr node. | |
| template<Mesh M> | |
| void | triqs::gfs::operator-= (gf_view< M > g, dcomplex a) |
| In-place subtraction of a scalar (times the identity) from a matrix-valued Green's function. | |
| template<Mesh M, nda::MemoryMatrix Mat> | |
| void | triqs::gfs::operator-= (gf_view< M > g, Mat const &mat) |
| In-place subtraction of a matrix from every mesh point of a matrix-valued Green's function. | |
| template<Mesh M> | |
| void | triqs::gfs::operator-= (gf_view< M, scalar_valued > g, dcomplex a) |
| In-place subtraction of a scalar from a scalar-valued Green's function. | |
| template<typename G1, typename G2, typename M> | |
| void | triqs::gfs::set_from_L_G_R (G1 &g1, M const &l, G2 const &g2, M const &r) |
| Set g1 = l * g2 * r at every mesh point (in place, optimized for speed). | |
| gf< M, matrix_valued > triqs::gfs::inverse | ( | gf< M, matrix_valued > | g | ) |
#include <triqs/gfs/functions/functions2.hpp>
Return the matrix inverse of a matrix-valued Green's function (inverts the target matrix at each mesh point).
| M | Mesh type. |
| g | The matrix-valued Green's function. |
Definition at line 285 of file functions2.hpp.
| gf< M, matrix_valued > triqs::gfs::inverse | ( | gf_const_view< M, matrix_valued > | g | ) |
#include <triqs/gfs/functions/functions2.hpp>
Const-view overload of triqs::gfs::inverse (makes a regular copy first).
Definition at line 296 of file functions2.hpp.
| gf< M, matrix_valued > triqs::gfs::inverse | ( | gf_view< M, matrix_valued > | g | ) |
#include <triqs/gfs/functions/functions2.hpp>
View overload of triqs::gfs::inverse (makes a regular copy first).
Definition at line 292 of file functions2.hpp.
| void triqs::gfs::invert_in_place | ( | gf_view< M, matrix_valued > | g | ) |
#include <triqs/gfs/functions/functions2.hpp>
Invert, in place, the target matrix at each mesh point of a matrix-valued Green's function.
| M | Mesh type. |
| g | The matrix-valued Green's function view, inverted in place. |
Definition at line 271 of file functions2.hpp.
| gf< M, matrix_valued > triqs::gfs::operator* | ( | gf< M, matrix_valued > | g, |
| matrix< T > | r ) |
#include <triqs/gfs/functions/functions2.hpp>
Right-multiply a matrix-valued Green's function by a matrix at every mesh point.
| M | Mesh type. |
| T | Scalar type of the matrix. |
| g | The matrix-valued Green's function. |
| r | The matrix multiplied from the right. |
Definition at line 429 of file functions2.hpp.
| gf< M, matrix_valued > triqs::gfs::operator* | ( | matrix< T > | l, |
| gf< M, matrix_valued > | g ) |
#include <triqs/gfs/functions/functions2.hpp>
Left-multiply a matrix-valued Green's function by a matrix at every mesh point.
| M | Mesh type. |
| T | Scalar type of the matrix. |
| l | The matrix multiplied from the left. |
| g | The matrix-valued Green's function. |
Definition at line 444 of file functions2.hpp.
| void triqs::gfs::set_from_L_G_R | ( | G1 & | g1, |
| M const & | l, | ||
| G2 const & | g2, | ||
| M const & | r ) |
#include <triqs/gfs/functions/functions2.hpp>
Set g1 = l * g2 * r at every mesh point (in place, optimized for speed).
| G1 | Type of the output Green's function. |
| G2 | Type of the input Green's function. |
| M | Matrix type. |
| g1 | The output Green's function (overwritten). |
| l | The left matrix factor. |
| g2 | The input Green's function. |
| r | The right matrix factor. |
Definition at line 478 of file functions2.hpp.