Class ResultExpr

Nested Relationships

Nested Types

Class Documentation

class ResultExpr

Represents an expression containing a left-hand-side of the form <lhs> = <expression> Thus, objects of this class are used to keep track of the result of a given expression as well as the expression itself.

This is particularly important when it comes to tracking the exact pairing (and symmetry) of external indices in cases the given expression computes a tensorial property.

Importantly, it is possible to track the result without giving an explicit name (label) to it.

Public Types

using IndexContainer = container::svector<Index>

Public Functions

ResultExpr(const Tensor &tensor, ExprPtr expression)
ResultExpr(const Variable &variable, ExprPtr expression)
template<typename Range1, typename Range2, typename Range3>
inline ResultExpr(bra<Range1> &&bra, ket<Range2> &&ket, aux<Range3> &&aux, Symmetry symm, BraKetSymmetry braket_symm, ColumnSymmetry column_symm, std::optional<std::wstring> label, ExprPtr expr)
ResultExpr(const ResultExpr &other) = default
ResultExpr(ResultExpr &&other) = default
ResultExpr &operator=(const ResultExpr &other) = default
ResultExpr &operator=(ResultExpr &&other) = default
ResultExpr &operator=(ExprPtr expression)

Assigns a new expression to this result.

bool has_label() const
const std::wstring &label() const
void set_label(std::wstring label)
Symmetry symmetry() const
void set_symmetry(Symmetry symm)
BraKetSymmetry braket_symmetry() const
void set_braket_symmetry(BraKetSymmetry symm)
ColumnSymmetry column_symmetry() const
void set_column_symmetry(ColumnSymmetry symm)
const IndexContainer &bra() const
const IndexContainer &ket() const
const IndexContainer &aux() const
const ExprPtr &expression() const
ExprPtr &expression()
ResultExpr clone() const
template<typename Group>
inline container::svector<Group> index_particle_grouping() const

Obtains the exact grouping (pairing) of indices in the result. Typically, this represents particle-assignments (i.e. indices in the same group are associated with the same particle in the underlying theory). This corresponds to columns of indices in the typical tensor notation.

Note: auxiliary indices are ignored by this function (the assumption being that they don’t belong to this kind of pairings).

Template Parameters:

Group – The type of the object to represent an index group. Must be constructible from an initializer_list<Index> or from a set of two indices. This allows for pair/tuple and vector-like types.

inline Tensor result_as_tensor (std::wstring default_label=L"Unnamed") const
inline Variable result_as_variable (std::wstring default_label=L"Unnamed") const
inline bool produces_tensor() const
bool operator==(const ResultExpr &other) const = default
struct ResultCmp

Public Functions

bool operator()(const ResultExpr &lhs, const ResultExpr &rhs) const