Commit 920a47d5 authored by Nils Kohl's avatar Nils Kohl 🌝 Committed by Martin Bauer
Browse files

Sorting set in add_subexpressions_for_divisions() simplification.

parent 144f46ed
...@@ -81,6 +81,7 @@ def add_subexpressions_for_divisions(ac: AC) -> AC: ...@@ -81,6 +81,7 @@ def add_subexpressions_for_divisions(ac: AC) -> AC:
for eq in ac.all_assignments: for eq in ac.all_assignments:
search_divisors(eq.rhs) search_divisors(eq.rhs)
divisors = sorted(list(divisors), key=lambda x: str(x))
new_symbol_gen = ac.subexpression_symbol_generator new_symbol_gen = ac.subexpression_symbol_generator
substitutions = {divisor: new_symbol for new_symbol, divisor in zip(new_symbol_gen, divisors)} substitutions = {divisor: new_symbol for new_symbol, divisor in zip(new_symbol_gen, divisors)}
return ac.new_with_substitutions(substitutions, True) return ac.new_with_substitutions(substitutions, True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment