Skip to content

Commit

Permalink
SIMD.py: Fix behavior of x^(-1/2), such that it uses the SIMD version…
Browse files Browse the repository at this point in the history
… of 1 instead of the integer 1
  • Loading branch information
zachetienne committed Sep 9, 2023
1 parent 1230b4d commit 2733884
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SIMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def expr_convert_to_SIMD_intrins(expr, map_sym_to_rat=None, prefix="", SIMD_find
SqrtSIMD(a)
>>> convert(a**(-1/2))
DivSIMD(1, SqrtSIMD(a))
DivSIMD(_Integer_1, SqrtSIMD(a))
>>> from sympy import Rational
>>> convert(a**Rational(1, 3))
Expand Down Expand Up @@ -205,7 +205,8 @@ def IntegerPowSIMD(a, n):
subtree.expr = SqrtSIMD(args[0])
subtree.children.pop(1)
elif exponent == -0.5:
subtree.expr = DivSIMD(1, SqrtSIMD(args[0]))
one = Symbol(prefix + "_Integer_1")
subtree.expr = DivSIMD(one, SqrtSIMD(args[0]))
tree.build(subtree)
elif exponent == Rational(1, 3):
subtree.expr = CbrtSIMD(args[0])
Expand Down

0 comments on commit 2733884

Please sign in to comment.