Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "tinydiffeq"
version = "2.6.0"
version = "2.6.1"
description = "Tiny differentiable ODE/SDE/DAE/SDAE solvers for JAX with static shapes and composable AD"
readme = "README.md"
license = "MIT"
Expand Down
14 changes: 11 additions & 3 deletions src/tinydiffeq/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import jax

from tinydiffeq.interpolation import hermite_derivative, hermite_interpolate


@jax.tree_util.register_dataclass
@dataclass(frozen=True)
Expand Down Expand Up @@ -35,9 +37,9 @@ class BVPSolution:

Arrays are padded to the static ``max_nodes``: the ``t`` tail repeats the
right endpoint and the ``y``/``yp`` tails repeat the last active row, so
``hermite_interpolate(ts, sol.t, sol.y, sol.yp)`` evaluates exactly the C1
cubic spline scipy's ``solve_bvp`` returns and ``hermite_derivative`` its
derivative. ``z`` holds the solved unknown parameters (``None`` when the
``sol(ts)`` evaluates exactly the C1 cubic spline scipy's ``solve_bvp``
returns and ``sol.derivative(ts)`` its derivative. ``z`` holds the solved
unknown parameters (``None`` when the
problem has none), ``rms_residuals`` is zero on inactive intervals,
``num_nodes`` counts active mesh nodes, and ``num_iterations`` is scipy's
``niter``. ``status`` uses scipy's codes (0 converged, 1 ``max_nodes``
Expand All @@ -59,6 +61,12 @@ class BVPSolution:
ok: jax.Array
aux: Any = None

def __call__(self, ts):
return hermite_interpolate(ts, self.t, self.y, self.yp)

def derivative(self, ts):
return hermite_derivative(ts, self.t, self.y, self.yp)


@jax.tree_util.register_dataclass
@dataclass(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading