scijit.interpolate.bispeu

scijit.interpolate.bispeu(x, y, tx, ty, c, kx, ky)

Evaluate a bivariate spline at scattered points, FITPACK bispeu.

The scattered-point sibling of bispev: it takes the query points as the pairs (x[i], y[i]) rather than a grid.

Parameters:
x1-D array_like of float

Abscissae of the query points.

y1-D array_like of float

Ordinates, SAME LENGTH as x – the points are the pairs (x[i], y[i]), not a grid. This is the difference from bispev.

tx1-D array_like of float

Knots in x, length nx.

ty1-D array_like of float

Knots in y, length ny.

c1-D array_like of float

Coefficients in the flat layout c[(ny-ky-1)*i + j].

kxint

Degree in x, 1 <= kx <= 5.

kyint

Degree in y, 1 <= ky <= 5.

Returns:
z1-D float64 ndarray, length len(x)

Spline value at each point.

Raises:
ValueError

If tx, ty, c, x or y has a rank other than 1, if x and y have different lengths, or if len(c) != (nx-kx-1)*(ny-ky-1). The coefficient test is an equality, so a padded c is rejected as well as a short one. Tested in that order.

Notes

scipy.interpolate publishes no name for this routine. It reaches the same computation only through RectBivariateSpline.ev(x, y).

Workspace is only kx + ky + 2 doubles: this routine walks the points one at a time, where bispev allocates mx*(kx+1) + my*(ky+1).

prange-safe: yes.

Examples

Evaluate a bilinear spline for f(x, y) = x + 2*y at two scattered points, from inside @njit:

>>> import numpy as np
>>> from numba import njit
>>> from scijit.interpolate import bispeu
>>> @njit
... def go():
...     tx = np.array([0., 0., 1., 1.])
...     ty = np.array([0., 0., 1., 1.])
...     c = np.array([0., 2., 1., 3.])  # corner values of x + 2*y
...     return bispeu(np.array([0.25, 0.75]), np.array([0.5, 0.5]),
...                   tx, ty, c, 1, 1)
>>> go()
array([1.25, 1.75])