Skip to content

Commit

Permalink
fix another negative bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfhm committed Oct 20, 2023
1 parent 9c2f441 commit b3b78ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion loki/transform/transform_scalar_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def single_sum(expr):
----------
expr: any pymbolic expression
"""

if isinstance(expr, pmbl.Sum):
return expr
return Sum((expr,))
Expand Down Expand Up @@ -78,14 +79,15 @@ def product_value(expr):
m = m*c
else:
new_children += [c]

if m == 0:
return 0
if not new_children:
return m

if m > 1:
new_children = [IntLiteral(m)] + new_children
elif m == -1:
new_children = [-1] + new_children
elif m < -1:
new_children = [-1, IntLiteral(abs(m))] + new_children

Expand Down

0 comments on commit b3b78ca

Please sign in to comment.