49 views

Skip to first unread message

May 1, 2020, 12:21:30 AM5/1/20

to symengine

Hi !

I just started playing with Symengine today for a "heavy" project I have. Replacing Sympy by Symengine did not work out of the box in my code. First, because the Lambidy-ed function from Symengine does not get "jit" in Numba, which a priori will become a problem for me. But it is not only that, after removing "jit", my code raised the following error:

I made a simple example below that reproduces the problem. Sympy does not meet issue here, but Symengine raises an exception.

Do you know what is happening?

------------------------------------

import symengine as se

import sympy as spimport numpy as np

x, y = se.var("x y")

expr = se.sin(x)*se.cos(y)

func = sp.lambdify((x,y), expr, 'numpy')

print(func(0, np.array([0,2])))

x, y = se.var("x y")

expr = se.sin(x)*se.cos(y)

func = se.Lambdify((x,y), expr)

print(func(np.pi/2, np.array([0, np.pi/2])))

------------------------------------

Thank you for your time and help!

Best,

Gaël

May 1, 2020, 3:39:30 PM5/1/20

to symengine

Hi,

Looks like this is a problem with broadcasting one input. For example, the following works,

import symengine as se

import sympy as sp

import numpy as np

x, y = se.var("x y")

expr = se.sin(x)*se.cos(y)

func = se.Lambdify((x,y), expr, backend='llvm')

print(func([np.pi/2, np.pi/2], np.array([0, np.pi/2])))

print(func([np.pi/2, np.pi/2], np.array([0, np.pi/2])))

Btw, backend='llvm' should work the same as Numba. (except no implicit multi-core support)

Isuru

--

You received this message because you are subscribed to the Google Groups "symengine" group.

To unsubscribe from this group and stop receiving emails from it, send an email to symengine+...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/symengine/0c22d5cb-1e5f-47ae-901a-2b9e42b9e02c%40googlegroups.com.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu