Class EvalExpr¶
Defined in File eval_expr.hpp
Inheritance Relationships¶
Derived Types¶
public sequant::EvalExprBTAS(Class EvalExprBTAS)public sequant::EvalExprTA(Class EvalExprTA)public sequant::ExportExpr(Class ExportExpr)
Class Documentation¶
-
class EvalExpr¶
The EvalExpr is a building block of binary trees used to evaluate expressions.
The EvalExpr class itself is not a proper node of the binary tree. It is rather a data that a node should hold.
Subclassed by sequant::EvalExprBTAS, sequant::EvalExprTA, sequant::ExportExpr
Public Types
-
using index_vector = Index::index_vector¶
Public Functions
- Parameters:
op – Evaluation operation resulting to this object.
res – Evaluation result type that will be produced.
expr – A SeQuant expression corresponding to
res.ixs – Canonical indices used for annotating the result’s modes if
resis tensor type. Possibly empty for non-tensorrestype.phase – Phase that was part of the tensor network canonicalization. Considered for reusing sub-expressions.
hash – A hash value that is equal for two EvalExpr objects that produce the same evaluated result modulo the
phase.connectivity – The graph representing the connectivity. May be null to indicate that no graph is present/necessary.
-
const std::optional<EvalOp> &op_type() const noexcept¶
- Returns:
Operation type of this expression, or null if this is a primary expression.
-
ResultType result_type() const noexcept¶
- Returns:
The ResultType of the evaluation performed on this node.
-
size_t hash_value() const noexcept¶
Compute the hash value of this EvalExpr object.
The hash value is computed during construction of the object by also looking at the hash values of the EvalExpr objects if passed.
- Returns:
The hash value of this EvalExpr object.
-
bool tot() const noexcept¶
- Returns:
True if this EvalExpr object contains a SeQuant tensor with proto-indices, false otherwise.
-
std::wstring to_latex() const noexcept¶
- Returns:
Returns the result of calling to_latex() on the ExprPtr object contained by this object.
-
bool is_tensor() const noexcept¶
-
bool is_scalar() const noexcept¶
- Returns:
True if the ExprPtr
held by this object is scalar(Constant, or
Variable) and equivalently the result of evaluation is scalar.
-
bool is_primary() const noexcept¶
- Returns:
True if this is a primary expression (i.e. a leaf on expression tree)
-
bool is_product() const noexcept¶
- Returns:
True if this expression is a product.
-
bool is_sum() const noexcept¶
- Returns:
True if this expression is a sum.
-
Tensor const &as_tensor() const¶
Calls to<Tensor>() on ExprPtr held by this object.
- Returns:
Tensor const&
-
Constant const &as_constant() const¶
Calls to<Constant>() on ExprPtr held by this object.
- Returns:
Constant const&.
-
Variable const &as_variable() const¶
Calls to<Variable>() on ExprPtr held by this object.
- Returns:
Variable const&
-
std::string label() const noexcept¶
Get the label for this object useful for logging.
-
std::string indices_annot() const noexcept¶
- Returns:
A string usable as TiledArray annotation if is_tensor() true, empty string otherwise.
-
index_vector const &canon_indices() const noexcept¶
- Returns:
Canonically ordered indices — non-empty if this object represents a tensor result.
-
std::int8_t canon_phase() const noexcept¶
- Returns:
The canonicalization phase (+1 or -1).
-
bool has_connectivity_graph() const noexcept¶
See also
- Returns:
Whether this expression has a connectivity graph
-
const bliss::Graph &connectivity_graph() const noexcept¶
See also
Note
If has_connectivity_graph returns false, this function must not be called
- Returns:
The graph representing the connectivity of two factors in a product
-
std::shared_ptr<bliss::Graph> copy_connectivity_graph() const noexcept¶
- Returns:
A copy of the graph representing the connectivity of two factors in a product
Protected Attributes
-
ResultType result_type_¶
-
index_vector canon_indices_¶
-
std::int8_t canon_phase_ = {1}¶
-
size_t hash_value_¶
-
std::shared_ptr<bliss::Graph> connectivity_¶
Friends
- friend struct EvalOpSetter
-
using index_vector = Index::index_vector¶