Skip to main content

normalize

Function normalize 

Source
pub fn normalize(expr: &AlgExpr) -> AlgExpr
Expand description

Produce a canonical form for expr:

  • For commutative Add and Mul, sort the operand string representations so that a + b and b + a both become the same canonical form.
  • Flatten nested Add(Add(a,b),c)Add(a, Add(b,c)).
  • Flatten nested Mul(Mul(a,b),c)Mul(a, Mul(b,c)).