Skip to content
Snippets Groups Projects
Commit 0b03c3db authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Avoid side effects in evaluation for numpy arrays by not using in-place ops.

parent 035b55ee
No related branches found
No related tags found
No related merge requests found
......@@ -36,12 +36,8 @@ class EvaluationMapper(RecursiveMapper):
return sum(self.rec(child) for child in expr.children)
def map_product(self, expr):
if len(expr.children) == 0:
return 1 # FIXME?
result = self.rec(expr.children[0])
for child in expr.children[1:]:
result *= self.rec(child)
return result
from pytools import product
return product(self.rec(child) for child in expr.children)
def map_quotient(self, expr):
return self.rec(expr.numerator) / self.rec(expr.denominator)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment