Skip to content

SymPy integration#502

Open
DoeringChristian wants to merge 1 commit into
masterfrom
sympy_integration
Open

SymPy integration#502
DoeringChristian wants to merge 1 commit into
masterfrom
sympy_integration

Conversation

@DoeringChristian
Copy link
Copy Markdown
Contributor

@DoeringChristian DoeringChristian commented May 23, 2026

This PR adds integration to sympy using the dr.wrap decorator.

SymPy is a symbolic expressions engine. This PR adds it as a target for dr.wrap, allowing us to compute higher order derivatives (hessians) etc in Dr.Jit. In contrast to other targets for this decorator the SymPy target does not exchange data between the libraries at runtime, but rather traces the symbolic expressions generated by the wrapped function, and compiles it to Dr.Jit. The wrapped function therefore acts like an ordinary Dr.Jit function, while we can use the complicated symbolic operations supported by SymPy. The wrapped functions are restricted to per-lane operations. Inverting a Matrix4f inside of this wrapper will generate the necessary code for Dr.Jit to invert the matrix. Calling the function with a Matrix array in Dr.Jit will therefore invert each matrix per SIMD lane.

@DoeringChristian DoeringChristian changed the title SymPU integration SymPy integration May 23, 2026
@wjakob
Copy link
Copy Markdown
Member

wjakob commented May 25, 2026

Hi Christian,

thank you for the PR, this looks like a very useful feature. My suggestion would be to do another crunching pass over the code. 1.5K is .. a lot! I feel like this code has some of the fluffiness of partly AI-generated and could do with some simplification passes to reduce it to a more minimal form (matching also the documented API surface).

Thanks,
Wenzel

@DoeringChristian DoeringChristian force-pushed the sympy_integration branch 2 times, most recently from b4f991e to 9e8f222 Compare May 27, 2026 14:26
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

Successfully merging this pull request may close these issues.

2 participants