Template Function sequant::apply_canon_phase

Function Documentation

template<Trace EvalTrace = Trace::Default, meta::can_evaluate Node, typename N, bool FHC>
ResultPtr sequant::apply_canon_phase(Node const &nd, ResultPtr res, CacheManager<N, FHC> &cache)

Multiply a result by its node’s canonicalization phase, with the trace event and peak accounting that conversion carries.

A cell/cache holds the canonical orientation of a value while every consumer wants the node’s own oriented one; the phase is an involution, so one multiply converts either way. Shared by evaluate_impl (through its apply_phase lambda) and the ordered executor’s detail::compute_cell, so both convert identically &#8212; including the MultByPhase trace event, whose note_working_set call is what puts the transient second buffer on the peak monitor.

A phase of 1 (the overwhelming majority) returns res untouched, with no event and no allocation.