Class EvalResult

Inheritance Relationships

Derived Types

Class Documentation

class EvalResult

A type-erased class for the result of an evaluation. An object of this class can represent a tensor (eg. TA::TArrayD, btas::Tesnor<double>, etc.) or a scalar (eg. double, complex<double> etc.).

Subclassed by sequant::EvalScalar< T >, sequant::EvalTensorBTAS< T >, sequant::EvalTensorOfTensorTA< ArrayT, typename >, sequant::EvalTensorTA< ArrayT, typename >

Public Types

using id_t = size_t

Public Functions

virtual ~EvalResult() noexcept = default
template<typename T>
inline bool is() const noexcept
Returns:

Returns true if the concrete type of the object is T.

template<typename T>
inline T const &as() const
Returns:

T const& where T is the concrete type of the object.

virtual ERPtr sum(EvalResult const&, std::array<std::any, 3> const&) const = 0

Sum other EvalResult object with this object.

Note

In std::array<std::any, 3> is expected to be [l,r,res] where the elements are the annotations for left, right and result respectively.

virtual ERPtr prod(EvalResult const&, std::array<std::any, 3> const&, TA::DeNest DeNestFlag) const = 0

Perform product binary operation with this object and other.

Note

In std::array<std::any, 3> is expected to be [l,r,res] where the elements are the annotations for left, right and result respectively.

virtual ERPtr permute(std::array<std::any, 2> const&) const = 0

Permute this object according to the annotations in the argument.

Note

In std::array<std::any, 2> is expected to be [pre,post] where the elements are the annotations for the eval result before permutation and after permutation respectively.

virtual void add_inplace(EvalResult const&) = 0

Add other EvalResult object into this object.

virtual ERPtr symmetrize(container::svector<std::array<size_t, 3>> const&) const = 0

Particle symmetrize this eval result according to the list of index groups.

Note

vector<array<size_t,3>> represents list of particle symmetry index groups. array<size_t, 3> is expected to be [b1, b2, len] where b1, and b2 are the zero-based positions of the tensor indices. [b1, b1+len) and [b2, b2+len) are two ranges that will be permuted simultaneously and at the equivalent positions.

virtual ERPtr antisymmetrize(container::svector<std::array<size_t, 3>> const&) const = 0

Particle antisymmetrize this eval result according to the list of index groups.

Note

vector<array<size_t,3>> represents list of antisymmetric index groups. array<size_t,3> is expected to be [b1,b2,len] where b1, and b2 are the zero-based positions of the tensor indices. [b1, b1+len) and [b2, b2+len) are two ranges that will be permuted by keeping track of the parity (even/odd)-ness of the total permutation.

bool has_value() const noexcept
template<typename T>
inline T &get()
Template Parameters:

T, and – return a ref.

Returns:

Cast the type-erased data to the type

template<typename T>
inline T const &get() const
Template Parameters:

T, and – return a const ref.

Returns:

Cast the type-erased data to the type

Protected Functions

template<typename T, typename = std::enable_if_t<!std::is_convertible_v<T, EvalResult>>>
inline explicit EvalResult(T &&arg) noexcept
virtual id_t type_id() const noexcept = 0

Protected Static Functions

template<typename T>
static inline id_t id_for_type() noexcept