xspline.bspl#
- xspline.bspl.cache_bspl(function)[source]#
Cache implementation for bspline basis functions, to avoid repetitively evaluate functions.
- Parameters:
function (Callable[[tuple, ndarray[Any, dtype[_ScalarType_co]]], ndarray[Any, dtype[_ScalarType_co]]] | Callable[[tuple, ndarray[Any, dtype[_ScalarType_co]], int], ndarray[Any, dtype[_ScalarType_co]]]) – Raw value, derivative and definite integral functions.
- Returns:
Cached version of the raw functions.
- Return type:
describe
- xspline.bspl.clear_bspl_cache()[source]#
Clear all cache of the value, derivative and definite integral for bspline function.
- Return type:
None
- class xspline.bspl.Bspl(params)[source]#
Bases:
BundleXFunction
Basis spline function.
- Parameters:
params (tuple[tuple[float, ...], int, int]) – This is a tuple that contains knots, degree and index of the basis function.
Example
>>> bspl = Bspl(((0.0, 1.0), 1, 0)) # knots=(0.0, 1.0), degree=2, index=0 >>> bspl([0.0, 1.0]) array([0., 1.]) >>> bspl([0.0, 1.0], order=1) array([1., 1.]) >>> bspl([0.0, 1.0], order=2) array([0., 0.]) >>> bspl([0.0, 1.0], order=-1) array([0. , 0.5])