Template Function sequant::eliminate_common_subexpressions

Function Documentation

template<std::ranges::range VectorLike, std::regular_invocable<ExprPtr> Transformer, std::predicate<std::ranges::range_value_t<VectorLike>, std::size_t> Filter = cse::AcceptAllPredicate, bool force_hash_collisions = false>
void sequant::eliminate_common_subexpressions(VectorLike &expr_trees, const Transformer &expr_to_tree, const Filter &filter_predicate = {})

Takes the range of expression trees and performs common subexpression elimination on them. Evaluation trees for intermediates are inserted into the given container as needed.

Parameters:
  • expr_trees – Container (vector-like) of evaluation trees

  • expr_to_tree – Functor that can convert ExprPtr and ResultExpr objects into suitable evaluation trees

  • filter_predicate – A predicate to filter out subexpressions that shall not be eliminated