grater_jax.disk_model.interpolated_univariate_spline
interpolated_univariate_spline.py
JAX implementation of 1D spline interpolation.
This module provides a JAX-compatible version of SciPy’s InterpolatedUnivariateSpline with support for linear, quadratic, and cubic splines. It includes evaluation, derivatives, antiderivatives, and definite integrals, while omitting unsupported options such as weights and smoothing.
Functions
|
Convert an object to a JAX array. |
|
Join arrays along an existing axis. |
|
Create an array full of ones. |
|
Extends the set of types that are considered internal nodes in pytrees. |
|
Vectorizing map. |
|
Create an array full of zeros. |
Classes
|
- class grater_jax.disk_model.interpolated_univariate_spline.InterpolatedUnivariateSpline(x, y, k=3, endpoints='not-a-knot', coefficients=None)
Bases:
object- tree_flatten()
Flatten the spline into JAX-compatible pytree children and auxiliary data.
- Returns:
A 2-tuple
(children, aux_data)wherechildrenis(x, y, coefficients)andaux_datais a dict with'endpoints'and'k'.- Return type:
tuple
- classmethod tree_unflatten(aux_data, children)
Reconstruct a spline from JAX pytree children and auxiliary data.
- Parameters:
aux_data (dict) – Dictionary with keys
'endpoints'and'k'as produced bytree_flatten.children (tuple) – Tuple
(x, y, coefficients)as produced bytree_flatten.
- Returns:
Reconstructed spline object.
- Return type:
- derivative(x, n=1)
Analytic nth derivative of the spline.
The spline has derivatives up to its order k.
- antiderivative(xs)
Computes the antiderivative of first order of this spline
- integral(a, b)
Compute a definite integral over a piecewise polynomial. :param a: Lower integration bound :type a: float :param b: Upper integration bound :type b: float
- Returns:
ig – Definite integral of the piecewise polynomial over [a, b]
- Return type:
array_like