Skip to main content

JAX bindings for the diffsol Rust ODE solver, callable inside jax.jit and differentiable with jax.grad.

Project description

Logo

JAX wrapper around diffsol, a Rust ODE solver library. Exposes diffsol's ODE solvers via jax.ffi so they can be called from inside jax.jit and differentiated with jax.grad.

The user writes an RHS function in Python, which gets lowered to a diffsl source string and compiled on first call.

Example usage

import jax
import jax.numpy as jnp
from diffsol_jax import ODEProblem

def lotka_volterra(t, y, p):
    x, yy = y[0], y[1]
    alpha, beta, delta, gamma = p[0], p[1], p[2], p[3]
    return (alpha * x - beta * x * yy, delta * x * yy - gamma * yy)

params = jnp.array([1.5, 1.0, 0.75, 3.0])
y0     = jnp.array([1.0, 0.5])

problem = ODEProblem(lotka_volterra, y0=y0, params=params)

t_span = jnp.array([0.0, 10.0])
ts, ys = jax.jit(lambda p: problem.solve(p, t_span))(params)
# ts: float64[200],  ys: float64[200, 2]

Limitations

  • CPU only
  • No vmap batching rule; vmap_method="sequential" gives correct results via a Python loop.
  • The DiffSL lowerer handles elementwise ops and the common ODE patterns (Lotka-Volterra, Lorenz). Operations like dot_general, reduce_sum, and concatenate are not supported, so neural ODEs are not supported yet.
  • Differentiation uses JAX-level forward sensitivities (no separate adjoint pass). DiffSL modules are JIT-compiled with Cranelift and cached per source string; the first call compiles, subsequent calls reuse the compiled module and update parameters via set_params.
  • Does not work with jax.pmap
  • Higher-order derivatives

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffsol_jax-0.0.2.tar.gz (880.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

diffsol_jax-0.0.2-cp313-cp313-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.13Windows x86-64

diffsol_jax-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

diffsol_jax-0.0.2-cp313-cp313-macosx_14_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

diffsol_jax-0.0.2-cp312-cp312-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.12Windows x86-64

diffsol_jax-0.0.2-cp312-cp312-manylinux_2_28_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

diffsol_jax-0.0.2-cp312-cp312-macosx_14_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

diffsol_jax-0.0.2-cp311-cp311-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.11Windows x86-64

diffsol_jax-0.0.2-cp311-cp311-manylinux_2_28_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

diffsol_jax-0.0.2-cp311-cp311-macosx_14_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

File details

Details for the file diffsol_jax-0.0.2.tar.gz.

File metadata

  • Download URL: diffsol_jax-0.0.2.tar.gz
  • Upload date:
  • Size: 880.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for diffsol_jax-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8388eafbb77176a6e8032ef1a947d6d12a10e79ef861d6f772db72075541c950
MD5 9efbfbd8dd3e56f8ed49b6e1367a8900
BLAKE2b-256 5c509c5dd32239ebfe9a118ad9791684ccb5c06ed196a4edbaf50253623567ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2.tar.gz:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cc149f3c02c47bfc7c927cd9f0fe492f1b264eb260a2a995474bc5d8c7e3c23c
MD5 98f4d5df9e845aa0bfc2aba1b56ef3a7
BLAKE2b-256 a89b99bf7e04f10ce4570b55e232220314fde3b9bd02c71005dc9102b6559f0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp313-cp313-win_amd64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4823f549a77808d6ba5a2693ca25b7e1cf03afc95b530ffd4a0059af79c7201
MD5 c824fbd61af9d912930c81903ddc5a64
BLAKE2b-256 5684f27c8651839b2c98badd7defbe2986bbffe623b3184c8ee80c31b525240f

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 041c88420afafe9da9dbdb4557ca269a618563e715e77eebd28e34fc912d4b50
MD5 d271218fff3a74eef6fad89cf19a1039
BLAKE2b-256 5e5968439f446b2845ef3ce527be055cf2bf160779e2117e2cef5d05df80abe2

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp313-cp313-macosx_14_0_arm64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b41bf02190f4e0d5ea59380666c5afc86fa42bbc518ad2421d106fc55a6f2dd5
MD5 0c4926d11a40d145e25a88dafe998cf3
BLAKE2b-256 a13facf92766f451f0c612e4a2d5d05fb987b149ba24461bc04b056628d85f6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp312-cp312-win_amd64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b381040d2a8442d22422be387d166e72864f67e46e886b8e6416770832119a2
MD5 19cacc8ff19ea400b7a7abd64a5c14b7
BLAKE2b-256 2191f6612c58dc6e0f1d4ec9a5bc5d7a8e23dd9cc2a6e16e759deeb550e77e25

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 3810e1ca66c9a68786d2b49106af51a59cd631623b5c833749c766db4be0955b
MD5 e3637c6f147a40a4b205ff3c35ee7b53
BLAKE2b-256 b041b31369ef4da70ffe940fdf578004492dc1924ce9aaf4f1b3b0bb1c7c91de

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5c9655c58de2dcf957ed0f0bcb2bf5fe735b8c796ea88d6929acbb8ce2520bf3
MD5 d9188ec8507106f9d98767483cc45638
BLAKE2b-256 0888824287e602a20f0842350935023b3626fda8ca2c1c1a7865a739408f38e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp311-cp311-win_amd64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8aeaa14a0971b8baecc0868801c6495bb32f959718f3419df97dcdfdfbdeaa7b
MD5 66a31c44e5661d9e4f458bbee895f633
BLAKE2b-256 74dc8eaaa71c94bd1da3a169a0e581d75ddb244e287a5384d19b076feec01d4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffsol_jax-0.0.2-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for diffsol_jax-0.0.2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e29799604c939190c3fc61f77ff34ff22d03c955a374a507f737db2c97eb7f7a
MD5 cf961e106051719ea156ba3c2ccdf879
BLAKE2b-256 d810fcabc254468274f839dd4f2794f5833246f35fe0fc067f5f0d081b7bbf97

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffsol_jax-0.0.2-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: ci.yml on jackbmontgomery/diffsol-jax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page