Template Function sequant::eval::detail::run_ordered_schedule_pre_results

Function Documentation

template<Trace EvalTrace = Trace::Default, meta::can_evaluate_range Nodes, typename F, typename N, bool FHC, typename ScopeGuardFactory = ::sequant::make_no_scope_guard>
container::svector<ResultPtr> sequant::eval::detail::run_ordered_schedule_pre_results(Nodes const &forest, OrderedSchedule const &ordered, RichSchedule const &rich, F const &leaf_evaluator, CacheManager<N, FHC> &cache, std::function<std::size_t(Index const&)> const &target, ScopeGuardFactory const &make_scope_guard = {}, std::function<bool(std::ranges::range_value_t<Nodes> const&)> const &is_volatile = {})

The shared core every ordered whole-forest entry point (evaluate_ordered_schedule's forest-wide sum and evaluate_ordered_multiroot's per-root map alike) delegates to &#8212; walks ordered.root.steps (a root-level BuildStep built directly, a root-level ScopeBlock realized via run_ordered_contracted_block) and returns each forest root’s own unpermuted, already-built value_result, aligned index-for-index with forest &#8212; i.e. exactly the pre_results combine_forest_roots expects, computed but not yet consumed by it. The upstream logic (schedule walk, cell table derivation, the run-completeness refusal) lives in the callers; see this file’s own.

Note

on why a concatenated multi-root forest gets cross-root CSE for free from compute_dag_boulevard's hash-keyed ValueCell bucketing (built upstream of this function, in rich) with no new dedup logic needed here: a value shared across two independent root trees is just another repeated hash, indistinguishable from a value shared across two summands of one root’s own forest, which this same walk already builds once.

Parameters:

forest – Same requirement as evaluate_ordered_schedule's forest: the roots whose results are computed by this call &#8212; either the summand terms of one equation or several independent equations’ own root trees (the multi-root caller); this function does not care which, since it produces one unpermuted, unsummed result per element of forest either way.

Returns:

Each element of forest's own already-built result, unpermuted, same order and length as forest.