Template Function sequant::fetch_leaf_traced

Function Documentation

template<Trace EvalTrace = Trace::Default, meta::can_evaluate Node, typename F, typename N, bool FHC>
ResultPtr sequant::fetch_leaf_traced(Node const &node, F const &leaf_evaluator, CacheManager<N, FHC> &cache)

Run the leaf evaluator on node, with the trace event and peak accounting a leaf fetch carries.

A leaf is accessed, not computed (the evaluator hands back a precomputed input), but it still enters the working set, so the event is emitted exactly as for an op. Shared by evaluate_impl's leaf branch and by the ordered executor’s detail::compute_cell – which runs the evaluator itself on a leaf operand’s first touch, before recording it as that leaf’s cell – so both account for it the same way.

The leaf evaluator is given the node, whose expr() is the canonical spelling of the leaf, and returns the array of that spelling. A leaf written in another order of an antisymmetric bundle (one whose bra or ket holds indices of several spaces) differs from it by the node’s leaf_phase, which is applied here, so that the result is the node’s own oriented value, as that of every other node is.

Returns:

the leaf’s own oriented result, whole (never sliced: the declared slice of a read is applied by CellReadResolver::fetch).