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
Jonas Plewinski
pystencils
Commits
a88cfc54
Commit
a88cfc54
authored
Sep 26, 2019
by
Stephan Seitz
Browse files
Eliminate usages of old name 'equation collection' for `AssignmentCollection`
parent
f1f2faee
Changes
3
Hide whitespace changes
Inline
Side-by-side
pystencils/simp/assignment_collection.py
View file @
a88cfc54
...
@@ -16,12 +16,12 @@ class AssignmentCollection:
...
@@ -16,12 +16,12 @@ class AssignmentCollection:
These simplification methods can change the subexpressions, but the number and
These simplification methods can change the subexpressions, but the number and
left hand side of the main equations themselves is not altered.
left hand side of the main equations themselves is not altered.
Additionally a dictionary of simplification hints is stored, which are set by the functions that create
Additionally a dictionary of simplification hints is stored, which are set by the functions that create
equation
collections to transport information to the simplification system.
assignment
collections to transport information to the simplification system.
Attributes:
Attributes:
main_assignments: list of assignments
main_assignments: list of assignments
subexpressions: list of assignments defining subexpressions used in main equations
subexpressions: list of assignments defining subexpressions used in main equations
simplification_hints: dict that is used to annotate the
equation
collection with hints that are
simplification_hints: dict that is used to annotate the
assignment
collection with hints that are
used by the simplification system. See documentation of the simplification rules for
used by the simplification system. See documentation of the simplification rules for
potentially required hints and their meaning.
potentially required hints and their meaning.
subexpression_symbol_generator: generator for new symbols that are used when new subexpressions are added
subexpression_symbol_generator: generator for new symbols that are used when new subexpressions are added
...
@@ -344,7 +344,7 @@ class AssignmentCollection:
...
@@ -344,7 +344,7 @@ class AssignmentCollection:
return
result
return
result
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"
Equation
Collection for "
+
","
.
join
([
str
(
eq
.
lhs
)
for
eq
in
self
.
main_assignments
])
return
"
Assignment
Collection for "
+
","
.
join
([
str
(
eq
.
lhs
)
for
eq
in
self
.
main_assignments
])
def
__str__
(
self
):
def
__str__
(
self
):
result
=
"Subexpressions:
\n
"
result
=
"Subexpressions:
\n
"
...
...
pystencils/simp/simplifications.py
View file @
a88cfc54
...
@@ -30,10 +30,10 @@ def sort_assignments_topologically(assignments: Sequence[Union[Assignment, Node]
...
@@ -30,10 +30,10 @@ def sort_assignments_topologically(assignments: Sequence[Union[Assignment, Node]
def
sympy_cse
(
ac
):
def
sympy_cse
(
ac
):
"""Searches for common subexpressions inside the
equation
collection.
"""Searches for common subexpressions inside the
assignment
collection.
Searches is done in both the existing subexpressions as well as the assignments themselves.
Searches is done in both the existing subexpressions as well as the assignments themselves.
It uses the sympy subexpression detection to do this. Return a new
equation
collection
It uses the sympy subexpression detection to do this. Return a new
assignment
collection
with the additional subexpressions found
with the additional subexpressions found
"""
"""
symbol_gen
=
ac
.
subexpression_symbol_generator
symbol_gen
=
ac
.
subexpression_symbol_generator
...
...
pystencils/simp/simplificationstrategy.py
View file @
a88cfc54
...
@@ -9,8 +9,8 @@ from pystencils.simp.assignment_collection import AssignmentCollection
...
@@ -9,8 +9,8 @@ from pystencils.simp.assignment_collection import AssignmentCollection
class
SimplificationStrategy
:
class
SimplificationStrategy
:
"""A simplification strategy is an ordered collection of simplification rules.
"""A simplification strategy is an ordered collection of simplification rules.
Each simplification is a function taking an
equation
collection, and returning a new simplified
Each simplification is a function taking an
assignment
collection, and returning a new simplified
equation
collection. The strategy can nicely print intermediate simplification stages and results
assignment
collection. The strategy can nicely print intermediate simplification stages and results
to Jupyter notebooks.
to Jupyter notebooks.
"""
"""
...
...
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