cupyx.scipy.interpolate.BarycentricInterpolator#

class cupyx.scipy.interpolate.BarycentricInterpolator(xi, yi=None, axis=0)[source]#

The interpolating polynomial for a set of points.

Constructs a polynomial that passes through a given set of points. Allows evaluation of the polynomial, efficient changing of the y values to be interpolated, and updating by adding more x values. For reasons of numerical stability, this function does not compute the coefficients of the polynomial. The value yi need to be provided before the function is evaluated, but none of the preprocessing depends on them, so rapid updates are possible.

Parameters:
  • xi (cupy.ndarray) – 1-D array of x-coordinates of the points the polynomial should pass through

  • yi (cupy.ndarray, optional) – The y-coordinates of the points the polynomial should pass through. If None, the y values will be supplied later via the set_y method

  • axis (int, optional) – Axis in the yi array corresponding to the x-coordinate values

Methods

__call__(x)[source]#

Evaluate the interpolating polynomial at the points x.

Parameters:

x (cupy.ndarray) – Points to evaluate the interpolant at

Returns:

y – Interpolated values. Shape is determined by replacing the interpolation axis in the original array with the shape of x

Return type:

cupy.ndarray

Notes

Currently the code computes an outer product between x and the weights, that is, it constructs an intermediate array of size N by len(x), where N is the degree of the polynomial.

add_xi(xi, yi=None)[source]#

Add more x values to the set to be interpolated.

The barycentric interpolation algorithm allows easy updating by adding more points for the polynomial to pass through.

Parameters:
  • xi (cupy.ndarray) – The x-coordinates of the points that the polynomial should pass through

  • yi (cupy.ndarray, optional) – The y-coordinates of the points the polynomial should pass through. Should have shape (xi.size, R); if R > 1 then the polynomial is vector-valued If yi is not given, the y values will be supplied later. yi should be given if and only if the interpolator has y values specified

set_yi(yi, axis=None)[source]#

Update the y values to be interpolated.

The barycentric interpolation algorithm requires the calculation of weights, but these depend only on the xi. The yi can be changed at any time.

Parameters:
  • yi (cupy.ndarray) – The y-coordinates of the points the polynomial should pass through. If None, the y values will be supplied later.

  • axis (int, optional) – Axis in the yi array corresponding to the x-coordinate values

__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.