Template Function sequant::sort_expr(Expr&, const Compare&)¶
Defined in File lexicographic_order.hpp
Function Documentation¶
-
template<expr_ptr_compare Compare = LexicographicExprCompare>
Expr &sequant::sort_expr(Expr &expr, const Compare &cmp = {})¶ Sorts
exprrecursively and in place according tocmp: the summands of every Sum are sorted, as are the factors of every Product insofar as they commute (i.e. the order of non-commuting factors is preserved). The order of equivalent summands/factors is preserved.- Parameters:
expr – the expression to sort
cmp – the strict weak order of expressions to sort by; the default orders expressions lexicographically (see LexicographicExprCompare), which, unlike canonicalization, yields an order that does not depend on the hashing algorithm
- Returns:
expr