Skip to content
Snippets Groups Projects
Commit 9a8e6f9b authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Omit distinction between normal and reduced assignments in AssignmentCollection

parent 9741c024
No related branches found
No related tags found
1 merge request!438Reduction Support
......@@ -9,8 +9,6 @@ import pystencils
from ..assignment import Assignment
from .simplifications import (sort_assignments_topologically, transform_lhs_and_rhs, transform_rhs)
from ..sympyextensions import count_operations, fast_subs
from ..sympyextensions import reduced_assign
from ..sympyextensions.reduction import ReducedAssignment
class AssignmentCollection:
......@@ -58,13 +56,8 @@ class AssignmentCollection:
subexpressions = list(itertools.chain.from_iterable(
[(a if isinstance(a, Iterable) else [a]) for a in subexpressions]))
# filter out reduced assignments
reduced_assignments = [a for a in main_assignments if isinstance(a, ReducedAssignment)]
main_assignments = [a for a in main_assignments if (a not in reduced_assignments)]
self.main_assignments = main_assignments
self.subexpressions = subexpressions
self.reductions = reduced_assignments
if simplification_hints is None:
simplification_hints = {}
......@@ -79,11 +72,6 @@ class AssignmentCollection:
else:
self.subexpression_symbol_generator = subexpression_symbol_generator
def add_reduction(self, lhs: sp.Symbol, op: str, rhs: sp.Expr) -> None:
"""Adds an entry to the simplification_hints dictionary and checks that is does not exist yet."""
assert lhs not in self.reductions, f"Reduction for lhs {lhs} exists"
self.reductions.append(reduced_assign(lhs, op, rhs))
def add_simplification_hint(self, key: str, value: Any) -> None:
"""Adds an entry to the simplification_hints dictionary and checks that is does not exist yet."""
assert key not in self.simplification_hints, "This hint already exists"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment