Class EvalExpr¶
Defined in File eval_expr.hpp
Inheritance Relationships¶
Derived Types¶
public sequant::EvalExprBTAS
(Class EvalExprBTAS)public sequant::EvalExprTA
(Class EvalExprTA)
Class Documentation¶
-
class EvalExpr¶
The EvalExpr class represents the object that go into the nodes of the binary tree that is used to evaluate the sequant expressions.
The EvalExpr class itself is not a proper node. It is rather a data that a node should hold.
Subclassed by sequant::EvalExprBTAS, sequant::EvalExprTA
Public Types
-
using index_vector = Index::index_vector¶
Public Functions
-
explicit EvalExpr(Tensor const &tnsr)¶
Construct an EvalExpr object from a tensor. The EvalOp is Id.
-
explicit EvalExpr(Constant const &c)¶
Construct an EvalExpr object from a Constant. The EvalOp is Id.
-
explicit EvalExpr(Variable const &v)¶
Construct an EvalExpr object from a Variable. The EvalOp is Id.
-
EvalExpr(EvalOp op, ResultType res, ExprPtr const &expr, index_vector ixs, std::int8_t phase, size_t hash)¶
- 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
res
is tensor type. Possibly empty for non-tensorres
type.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
.
-
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.
-
Tensor const &as_tensor() const noexcept¶
Calls to<Tensor>() on ExprPtr held by this object.
- Returns:
Tensor const&
-
Constant const &as_constant() const noexcept¶
Calls to<Constant>() on ExprPtr held by this object.
- Returns:
Constant const&.
-
Variable const &as_variable() const noexcept¶
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).
-
using index_vector = Index::index_vector¶