JuliaSymbolics/SymbolicUtils.jl

CSE does not perform nested nested eliminations of repeated expressions

cdsousa opened this issue · 0 comments

Example:

using Symbolics
@variables x y
e = (x*y) + sin(x*y) + sqrt(sin(x*y))
Symbolics.cse(e)

returns an intermediate variable for x*y and another for sin(x*y).
It would be expected that the second variable includes the first one in the argument of sin rather than a repeated x*y.

This was working OK before the commit "CSE only exprs that appear more than once" 2c60e25
The previous behavior, while suboptimal, is much preferable for the effect of code optimization.