Template Function sequant::evaluate_each

Function Documentation

template<Trace EvalTrace = Trace::Default, meta::can_evaluate_range Nodes, typename F, typename N, bool FHC, typename ScopeGuardFactory = make_no_scope_guard>
container::svector<ResultPtr> sequant::evaluate_each(Nodes const &forest, BatchPolicy const &policy, F const &leaf_evaluator, CacheManager<N, FHC> &cache, std::initializer_list<std::wstring> mode_order = {}, ScopeGuardFactory make_scope_guard = {})

As evaluate(forest, policy, layout, ...), for a forest whose roots are results in their own right (the residuals of different equations, an energy) rather than the summands of one: the roots are not summed, and each is returned as it was built.

The roots share cache either way. On the ordered arm they also make one schedule (eval::evaluate_ordered_each); on the forest descent each is evaluated in turn. Under an eval trace the results are metered as the caller holds them: a finished root counts toward the working set of every later one, and all of them at the end (eval::detail::HeldResults), so cache must be the root of its chain.

Note

Which multi-root entry to call:

  • evaluate_each (this): the policy picks the scheduler and the schedule is built here from the forest; results come back as built.

  • eval::evaluate_ordered_multiroot: the ordered scheduler with a schedule the caller built (and may reuse across evaluations), and a layout per root.

  • evaluate_multiroot (eval.hpp): the same, reached through the driver a caller installed on the cache.

  • evaluate(forest, policy, layout, ...): the roots are the summands of one result, and are summed.

Template Parameters:

Nodes – a forward range.

Returns:

One ResultPtr per root of forest, in its order.