Class Result¶
Defined in File result.hpp
Inheritance Relationships¶
Derived Type¶
public sequant::ResultScalar< T >(Template Class ResultScalar)
Class Documentation¶
-
class Result¶
A type-erased class for the result of an evaluation. An object of this class can represent a tensor (eg. TA::DistArray, btas::Tensor, etc.) or a scalar (eg. double, std::complex etc.).
Subclassed by sequant::ResultScalar< T >
Public Types
-
using id_t = size_t¶
Public Functions
-
virtual ~Result() 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 ResultPtr sum(Result const&, std::array<std::any, 3> const&) const = 0¶
Sum other Result 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 ResultPtr prod(Result const&, std::array<std::any, 3> const&, 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 ResultPtr 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.
-
inline virtual ResultPtr adjoint(std::array<std::any, 2> const&) const¶
Take the adjoint (complex-conjugate transpose) of this result.
Used to evaluate the EvalOp::Adjoint IR node — the unary op that holds a bare-label operand and emits T† = conj(T) permuted into the adjoint slot order.
annis [operand_annot, result_annot] (bra/ket swapped relative to the operand); backends with a real numeric type implement this as a pure permutation (conj is a no-op) and complex backends apply conj as well. Not a pure virtual: only tensor-backed results need it; the default throws. Mirrors the slice_mode precedent.
-
inline virtual ResultPtr slice_mode(std::size_t, std::size_t, std::size_t) const¶
Restrict this result to a contiguous element range of one mode.
Keeps elements
[elem_lo, elem_hi)of modemodeand all elements of every other mode. Element semantics keep this backend-neutral (no notion of tiles); a tiled backend may require[elem_lo, elem_hi)to fall on tile boundaries (mode_batches() returns such ranges). Used to evaluate a tensor network in batches over a contracted index (see make_batched_custom_evaluator): slicing every leaf that carries the index, evaluating, and summing reproduces the full contraction. Not a pure virtual: only tensor-backed results need it; the default throws.
-
inline virtual container::svector<std::pair<std::size_t, std::size_t>> mode_batches(std::size_t, std::size_t) const¶
Partition mode
modeinto contiguous element-range batches, each covering abouttarget_batch_sizeelements.- Returns:
a list of
[elem_lo, elem_hi)element ranges that tile the mode’s full extent without overlap or gap. The partition is chosen by the backend at its storage granularity: a tiled backend snaps batch boundaries to tile boundaries (so batches are uneven and each covers at leasttarget_batch_sizeelements where possible), a dense backend may split evenly. A single returned batch means the mode is not worth (or cannot be) split. Backend-neutral: the target is expressed in elements, not tiles. Default: not supported.
-
virtual ResultPtr antisymmetrize(size_t bra_rank) const = 0¶
Particle antisymmetrize the eval result.
-
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
-
virtual std::size_t size_in_bytes() const = 0¶
- Returns:
the size of the object in bytes
-
using id_t = size_t¶