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

Perform doit() while lambdifying #376

Open
redeboer opened this issue Dec 6, 2021 · 0 comments
Open

Perform doit() while lambdifying #376

redeboer opened this issue Dec 6, 2021 · 0 comments
Labels
💫 Good first issue Good for newcomers 🔨 Maintenance Maintenance and upkeep improvements

Comments

@redeboer
Copy link
Member

redeboer commented Dec 6, 2021

It might be an idea to perform doit() on UnevaluatedExpression classes while lambdifying. This removes the need to call doit() before creating a function, which is slow on large expressions (see #280).

Rough sketch:

class CustomNumPyPrinter(NumPyPrinter):
    ...
    def _print_UnevaluatedExpression(self, expr, *args) -> str:
        return self._print(expr.doit(deep=False))

Note that this might still leaves classes like CG unevaluated. So those will need to be evaluated (doit()) as well. The idea is the same as above, but this could be implemented with a decorator, just like _forward_to_numpy_printer().

@redeboer redeboer added the 🔨 Maintenance Maintenance and upkeep improvements label Dec 6, 2021
@redeboer redeboer added this to the 0.4.1 milestone Dec 6, 2021
@redeboer redeboer added the 💫 Good first issue Good for newcomers label Dec 6, 2021
@redeboer redeboer modified the milestones: 0.4.1, 0.4.2 Jan 5, 2022
@redeboer redeboer removed this from the 0.4.2 milestone Feb 25, 2022
@redeboer redeboer changed the title Perform doit while lambdifying Perform doit() while lambdifying Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💫 Good first issue Good for newcomers 🔨 Maintenance Maintenance and upkeep improvements
Projects
None yet
Development

No branches or pull requests

1 participant