cupyx.scipy.interpolate.NdBSpline#
- class cupyx.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 theN
dimensions: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 vectort
evaluated atx
.- Parameters:
t (tuple of 1D ndarrays) – knot vectors in directions 1, 2, … N,
len(t[i]) == n[i] + k + 1
c (ndarray, shape (n1, n2, ..., nN, ...)) – b-spline coefficients
k (int or length-d tuple of integers) – spline degrees. A single integer is interpreted as having this degree for all dimensions.
extrapolate (bool, optional) – Whether to extrapolate out-of-bounds inputs, or return nan. Default is to extrapolate.
- Variables:
See also
Methods
- __call__(xi, *, nu=None, extrapolate=None)[source]#
Evaluate the tensor product b-spline at
xi
.- Parameters:
xi (array_like, shape(..., ndim)) – The coordinates to evaluate the interpolator at. This can be a list or tuple of ndim-dimensional points or an array with the shape (num_points, ndim).
nu (array_like, optional, shape (ndim,)) – Orders of derivatives to evaluate. Each must be non-negative. Defaults to the zeroth derivivative.
extrapolate (bool, optional) – Whether to exrapolate based on first and last intervals in each dimension, or return nan. Default is to
self.extrapolate
.
- Returns:
values – Interpolated values at
xi
- Return type:
ndarray, shape
xi.shape[:-1] + self.c.shape[ndim:]
- classmethod design_matrix(xvals, t, k, extrapolate=True)[source]#
Construct the design matrix as a CSR format sparse array.
- Parameters:
xvals (ndarray, shape(npts, ndim)) – Data points.
xvals[j, :]
gives thej
-th data point as anndim
-dimensional array.t (tuple of 1D ndarrays, length-ndim) – Knot vectors in directions 1, 2, … ndim,
k (int) – B-spline degree.
extrapolate (bool, optional) – Whether to extrapolate out-of-bounds values of raise a ValueError
- Returns:
design_matrix – Each row of the design matrix corresponds to a value in xvals and contains values of b-spline basis elements which are non-zero at this value.
- Return type:
a CSR matrix
- __eq__(value, /)#
Return self==value.
- __ne__(value, /)#
Return self!=value.
- __lt__(value, /)#
Return self<value.
- __le__(value, /)#
Return self<=value.
- __gt__(value, /)#
Return self>value.
- __ge__(value, /)#
Return self>=value.