Class BicubicInterpolator
- java.lang.Object
-
- org.apache.commons.math4.legacy.analysis.interpolation.BicubicInterpolator
-
- All Implemented Interfaces:
BivariateGridInterpolator
public class BicubicInterpolator extends Object implements BivariateGridInterpolator
Generates abicubic interpolating function
.Caveat: Because the interpolation scheme requires that derivatives be specified at the sample points, those are approximated with finite differences (using the 2-points symmetric formulae). Since their values are undefined at the borders of the provided interpolation ranges, the interpolated values will be wrong at the edges of the patch. The
interpolate
method will return a function that overridesBicubicInterpolatingFunction.isValidPoint(double,double)
to indicate points where the interpolation will be inaccurate.- Since:
- 3.4
-
-
Constructor Summary
Constructors Constructor Description BicubicInterpolator()
Default constructor.BicubicInterpolator(boolean initializeDerivatives)
Creates an interpolator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BicubicInterpolatingFunction
interpolate(double[] xval, double[] yval, double[][] fval)
Compute an interpolating function for the dataset.
-
-
-
Constructor Detail
-
BicubicInterpolator
public BicubicInterpolator()
Default constructor. The argumentinitializeDerivatives
is set tofalse
.
-
BicubicInterpolator
public BicubicInterpolator(boolean initializeDerivatives)
Creates an interpolator.- Parameters:
initializeDerivatives
- Whether to initialize the internal data needed for calling any of the methods that compute the partial derivatives of thefunction
returned from the call tointerpolate
.
-
-
Method Detail
-
interpolate
public BicubicInterpolatingFunction interpolate(double[] xval, double[] yval, double[][] fval) throws NoDataException, DimensionMismatchException, NonMonotonicSequenceException, NumberIsTooSmallException
Compute an interpolating function for the dataset.- Specified by:
interpolate
in interfaceBivariateGridInterpolator
- Parameters:
xval
- All the x-coordinates of the interpolation points, sorted in increasing order.yval
- All the y-coordinates of the interpolation points, sorted in increasing order.fval
- The values of the interpolation points on all the grid knots:fval[i][j] = f(xval[i], yval[j])
.- Returns:
- a function which interpolates the dataset.
- Throws:
NoDataException
- if any of the arrays has zero length.DimensionMismatchException
- if the array lengths are inconsistent.NonMonotonicSequenceException
- if the array is not sorted.NumberIsTooSmallException
- if the number of points is too small for the order of the interpolation
-
-