From 920a47d529a7a0615f98ec625506281024e44ea0 Mon Sep 17 00:00:00 2001 From: Nils Kohl <nils.kohl@fau.de> Date: Mon, 29 Apr 2019 14:32:04 +0200 Subject: [PATCH] Sorting set in add_subexpressions_for_divisions() simplification. --- pystencils/simp/simplifications.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pystencils/simp/simplifications.py b/pystencils/simp/simplifications.py index 47a9a9f64..d6077b8f6 100644 --- a/pystencils/simp/simplifications.py +++ b/pystencils/simp/simplifications.py @@ -81,6 +81,7 @@ def add_subexpressions_for_divisions(ac: AC) -> AC: for eq in ac.all_assignments: search_divisors(eq.rhs) + divisors = sorted(list(divisors), key=lambda x: str(x)) new_symbol_gen = ac.subexpression_symbol_generator substitutions = {divisor: new_symbol for new_symbol, divisor in zip(new_symbol_gen, divisors)} return ac.new_with_substitutions(substitutions, True) -- GitLab