Skip to content

Commit 6e9c0a4

Browse files
Ravindu-Hirimuthugodainducer
authored andcommitted
Pymbolic->symengine floordiv
1 parent 13e83df commit 6e9c0a4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pymbolic/interop/common.py

+3
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ def map_variable(self, expr):
156156
def map_constant(self, expr):
157157
return self.sym.sympify(expr)
158158

159+
def map_floor_div(self, expr):
160+
return self.sym.floor(self.rec(expr.numerator) / self.rec(expr.denominator))
161+
159162
def map_call(self, expr):
160163
if isinstance(expr.function, prim.Variable):
161164
func_name = expr.function.name

test/test_sympy.py

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def _test_from_pymbolic(mapper, sym, use_symengine):
9696
sym.Subs(x**2, (x,), (y,))
9797
deriv = sym.Derivative(x**2, x)
9898
assert mapper(prim.Derivative(x_**2, ("x",))) == deriv
99+
floordiv = sym.floor(x / y)
100+
assert mapper(prim.FloorDiv(x_, y_)) == floordiv
99101

100102
if use_symengine:
101103
assert mapper(x_[0]) == sym.Function("Indexed")("x", 0)

0 commit comments

Comments
 (0)