Template Function sequant::evaluate_multiroot¶
Defined in File eval.hpp
Function Documentation¶
-
template<Trace EvalTrace = Trace::Default, typename node_t, typename F, typename N, bool FHC>
container::svector<ResultPtr> sequant::evaluate_multiroot(container::svector<node_t> const &roots, container::svector<std::string> const &layouts, F const &leaf_evaluator, CacheManager<N, FHC> &cache)¶ The multi-root dispatch entry. Consults the cache’s
multiroot_driver()(cache_manager.hpp) and routes the whole set of independentrootsthrough it, returning one result per root with no cross-root summation (a map, not a sum). A multi-root caller has no cheap per-tree fallback that would still give the cross-root CSE this entry point exists for (seemultiroot_driver_type’s own doc comment) — so with no driver installed this throws rather than silently degrading to N independent (non-CSE’d) evaluations. The intended driver (installed viacache.set_multiroot_driver(...)) is the ordered executor’sevaluate_ordered_multiroot(ordered_executor.hpp), closed over the caller’s ownOrderedSchedule/RichSchedule/target/batching policy.- Parameters:
roots – The independent root trees to evaluate; a subexpression shared across two or more of them is built exactly once by a driver that concatenates them into one schedule (the ordered executor’s own contract — see
evaluate_ordered_multiroot).layouts – The layout each root’s own result is permuted to, one entry per element of
rootsin the same order; same meaning as the forest-rangeevaluate’slayout, applied per-root (not once across a cross-root sum) — this is what lets heterogeneous roots (e.g. distinct CC residual annotations) each land in their own layout.leaf_evaluator – Unused when a driver is installed (its own leaf evaluator lives inside the driver’s closure) — present only so this entry’s own call signature matches the rest of the
evaluatefamily; kept for interface symmetry, not consulted directly here (there being no per-tree fallback path to consult it on).cache – The cache whose
multiroot_driver()is consulted.
- Throws:
- Returns:
One
ResultPtrper element ofroots, inroots'own order.