NdBSpline#
- class scipy.interpolate.NdBSpline(t, c, k, *, extrapolate=None)[source]#
Tensor product spline object.
The value at point
xp = (x1, x2, ..., xN)is evaluated as a linear combination of products of one-dimensional b-splines in each of theNdimensions:c[i1, i2, ..., iN] * B(x1; i1, t1) * B(x2; i2, t2) * ... * B(xN; iN, tN)
Here
B(x; i, t)is thei-th b-spline defined by the knot vectortevaluated atx.- Parameters:
- ttuple of 1D ndarrays
knot vectors in directions 1, 2, … N,
len(t[i]) == n[i] + k + 1- cndarray, shape (n1, n2, …, nN, …)
b-spline coefficients
- kint or length-d tuple of integers
spline degrees. A single integer is interpreted as having this degree for all dimensions.
- extrapolatebool, optional
Whether to extrapolate out-of-bounds inputs, or return nan. Default is to extrapolate.
- Attributes:
- ttuple of ndarrays
Knots vectors.
- cndarray
Coefficients of the tensor-product spline.
- ktuple of integers
Degrees for each dimension.
- extrapolatebool, optional
Whether to extrapolate or return nans for out-of-bounds inputs. Defaults to true.
Methods
__call__(xi, *[, nu, extrapolate])Evaluate the tensor product b-spline at
xi.derivative(nu)Construct a new NdBSpline representing the partial derivative.
design_matrix(xvals, t, k[, extrapolate])Construct the design matrix as a CSR format sparse array.
See also
Notes
Array API Standard Support
NdBSplinehas experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variableSCIPY_ARRAY_API=1and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
⛔
PyTorch
✅
⛔
JAX
⚠️ no JIT
⛔
Dask
⛔
n/a
See Support for the array API standard for more information.