Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source code of symengine lambdify function? #490

Open
Zhyrek opened this issue Sep 19, 2024 · 1 comment
Open

Source code of symengine lambdify function? #490

Zhyrek opened this issue Sep 19, 2024 · 1 comment

Comments

@Zhyrek
Copy link

Zhyrek commented Sep 19, 2024

Hello, I was just wondering if there was a way to dynamically get the source code for a lambdify'd function in symengine? This is one of the last use cases that I need both symengine and sympy for.

E.g.:

import sympy as sp
import symengine as se

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

f = 2*x*y

lambdify_sp = sp.lambdify((x, y), f, "math")
lambdify_se = se.lambdify((x, y), [f])
print("Sympy source")
print(lambdify_sp.__doc__)
print("_________")
print("Symengine source?")
print(lambdify_se.__doc__)
print("_________")
Sympy source
Created with lambdify. Signature:

func(x, y)

Expression:

2*x*y

Source code:

def _lambdifygenerated(x, y):
    return 2*x*y


Imported modules:


_________
Symengine source?
None
_________
@bjodah
Copy link
Contributor

bjodah commented Sep 24, 2024

No, currently there's no such way. I guess we could add some method of dumping LLVM IR, if that's helpful. But I think it's almost only useful when debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants