Skip to content

Perform doit() while lambdifying #376

@redeboer

Description

@redeboer

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().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions