acvm::compiler::optimizers::general

Function simplify_mul_terms

Source
fn simplify_mul_terms<F: AcirField>(gate: Expression<F>) -> Expression<F>
Expand description

Simplifies all mul terms of the form scale*w1*w2 with the same bi-variate variables while also removing terms that end up with a zero coefficient.

For instance, mul terms 0*w1*w1 + 2*w2*w1 - w2*w1 - w1*w2 will return an empty vector, because: w1w2 and w2w1 are the same bi-variate variable and the resulting scale is 2-1-1 = 0