Template Function sequant::evaluate(Node const&, F const&, CacheManager<N, FHC>&)¶
Defined in File eval.hpp
Function Documentation¶
-
template<Trace EvalTrace = Trace::Default, detail::CacheCheck Cache = detail::CacheCheck::Checked, meta::can_evaluate Node, typename F, typename N, bool FHC>
ResultPtr sequant::evaluate(Node const &node, F const &le, CacheManager<N, FHC> &cache)¶ Note
The traversal is iterative: it maintains its own explicit work stack (a
std::dequeof frames) rather than recursing, so evaluation depth is bounded by the heap, not the C++ call stack. This keeps deep trees (e.g. a Sum or product chain with thousands of operands) stack-safe. Custom-evaluator interception is preserved exactly: it is consulted when a frame is first visited and a non-null result short-circuits the subtree (its children are never pushed), so subtree pruning — the mechanism batched eval relies on — is unaffected.- Template Parameters:
EvalTrace – If Trace::On, trace is written to the logger’s stream. Default is to follow Trace::Default, which is itself equal to Trace::On or Trace::Off.
Cache – If CacheCache::Checked (default) the root
nodeis looked up incachebefore evaluating; a hit short-circuits it. Child nodes are always evaluated Checked. Unchecked skips the lookup for the root only.
- Parameters:
node – A node that can be evaluated using
leas the leaf evaluator.le – The leaf evaluator that satisfies
meta::leaf_node_evaluator<Node, F>.cache – The cache for common sub-expression elimination.
- Returns:
Evaluated result as ResultPtr.