TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::gfs::gf_expr< Tag, L, R >

#include <triqs/gfs/gf/gf_expr.hpp>

Detailed Description

template<typename Tag, typename L, typename R>
struct triqs::gfs::gf_expr< Tag, L, R >

Lazy expression node representing a binary operation between two Green's function operands.

Models the GreenFunction concept, so expressions can be nested and assigned to a triqs::gfs::gf. The mesh and target are deduced from the operands and the operation is evaluated lazily, element by element, on access.

Template Parameters
TagOperation tag (+, -, *, /).
LType of the left operand (a Green's function or a wrapped scalar).
RType of the right operand (a Green's function or a wrapped scalar).

Definition at line 172 of file gf_expr.hpp.

Public Types

using L_t = std::remove_reference_t<L>
 Decayed type of the left operand.
using mesh_t = typename gfs_expr_tools::_or_<typename L_t::mesh_t, typename R_t::mesh_t>::type
 Mesh type of the expression, deduced from the two operands.
using R_t = std::remove_reference_t<R>
 Decayed type of the right operand.
using regular_t = gf<mesh_t, target_t>
 Regular (owning) type the expression evaluates to.
using target_t = typename gfs_expr_tools::_or_<typename L_t::target_t, typename R_t::target_t>::type
 Target type of the expression, deduced from the two operands.

Public Member Functions

template<typename LL, typename RR>
 gf_expr (LL &&l_, RR &&r_)
 Construct from the two operands.
auto data_shape () const
 Get the data shape of the expression.
auto const & mesh () const
 Get the mesh of the expression (computed lazily and cached).
template<typename... Args>
decltype(auto) operator() (Args &&...1) const
 Evaluate the expression via call at the given arguments (one per mesh dimension).
template<typename... Keys>
decltype(auto) operator[] (Keys &&...keys) const
 Evaluate the expression via subscript at the given keys.

Public Attributes

l
 Left operand.
r
 Right operand.

Friends

std::ostream & operator<< (std::ostream &sout, gf_expr const &expr)
 Stream output of the expression.

Constructor & Destructor Documentation

◆ gf_expr()

template<typename Tag, typename L, typename R>
template<typename LL, typename RR>
triqs::gfs::gf_expr< Tag, L, R >::gf_expr ( LL && l_,
RR && r_ )
inline

Construct from the two operands.

Template Parameters
LLForwarding type of the left operand.
RRForwarding type of the right operand.
Parameters
l_Left operand.
r_Right operand.

Definition at line 205 of file gf_expr.hpp.

Member Function Documentation

◆ data_shape()

template<typename Tag, typename L, typename R>
auto triqs::gfs::gf_expr< Tag, L, R >::data_shape ( ) const
inline

Get the data shape of the expression.

Returns
The combined data shape of the two operands.

Definition at line 224 of file gf_expr.hpp.

◆ mesh()

template<typename Tag, typename L, typename R>
auto const & triqs::gfs::gf_expr< Tag, L, R >::mesh ( ) const
inline

Get the mesh of the expression (computed lazily and cached).

Returns
A const reference to the combined mesh.

Definition at line 215 of file gf_expr.hpp.

◆ operator()()

template<typename Tag, typename L, typename R>
template<typename... Args>
decltype(auto) triqs::gfs::gf_expr< Tag, L, R >::operator() ( Args &&... 1) const
inline

Evaluate the expression via call at the given arguments (one per mesh dimension).

Template Parameters
ArgsTypes of the evaluation arguments.
Returns
The result of applying the operation to the operands' evaluated values.

Definition at line 243 of file gf_expr.hpp.

◆ operator[]()

template<typename Tag, typename L, typename R>
template<typename... Keys>
decltype(auto) triqs::gfs::gf_expr< Tag, L, R >::operator[] ( Keys &&... keys) const
inline

Evaluate the expression via subscript at the given keys.

Template Parameters
KeysTypes of the access keys.
Parameters
keysMesh points/indices.
Returns
The result of applying the operation to the operands' subscripted values.

Definition at line 233 of file gf_expr.hpp.


The documentation for this struct was generated from the following files: