Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tom Harke
pystencils
Commits
920a47d5
Commit
920a47d5
authored
Apr 29, 2019
by
Nils Kohl
🌝
Committed by
Martin Bauer
May 03, 2019
Browse files
Sorting set in add_subexpressions_for_divisions() simplification.
parent
144f46ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/simp/simplifications.py
View file @
920a47d5
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment