scijit.interpolate.spalde¶
- scijit.interpolate.spalde(x, tck)¶
Evaluate all derivatives of a spline at one point.
- Parameters:
- xfloat
A SCALAR evaluation point, inside the knot range.
- tcktuple of (t, c, k)
Spline representation.
- Returns:
- d1-D float64 ndarray, length
k + 1 d[j]is the j-th derivative at x, withd[0]the value itself.
- d1-D float64 ndarray, length
- Raises:
- TypeError
If x lies outside
[t[k], t[n-k-1]], or a knot interval is degenerate.- ValueError
If c holds fewer than
len(t) - k - 1coefficients.
See also
scipy.interpolate.spaldeThe scipy routine this mirrors.
Notes
x is one point. scipy also accepts an array of m points and returns a LIST of m arrays for
m > 1, a bare array form == 1. The return type there follows a run-time length, which a compiled body cannot do. Call it once per point in a loop; inside@njitthe loop is compiled, so it carries no per-iteration overhead.
prange-safe: yes.
Examples
>>> import numpy as np >>> from numba import njit >>> from scijit.interpolate import splrep, spalde >>> x = np.linspace(0, 4, 40) >>> tck = splrep(x, np.sin(x)) >>> @njit ... def derivs(tck): ... return spalde(0.0, tck) >>> np.round(derivs(tck), 6) array([-0.000000e+00, 1.000019e+00, -6.700000e-04, -9.908410e-01])