public class DividedDifferenceInterpolator extends Object implements UnivariateInterpolator, Serializable
The actual code of Neville's evaluation is in PolynomialFunctionLagrangeForm, this class provides an easy-to-use interface to it.
Constructor and Description |
---|
DividedDifferenceInterpolator() |
Modifier and Type | Method and Description |
---|---|
protected static double[] |
computeDividedDifference(double[] x,
double[] y)
Return a copy of the divided difference array.
|
PolynomialFunctionNewtonForm |
interpolate(double[] x,
double[] y)
Compute an interpolating function for the dataset.
|
public PolynomialFunctionNewtonForm interpolate(double[] x, double[] y)
interpolate
in interface UnivariateInterpolator
x
- Interpolating points array.y
- Interpolating values array.DimensionMismatchException
- if the array lengths are different.NumberIsTooSmallException
- if the number of points is less than 2.NonMonotonicSequenceException
- if x
is not sorted in
strictly increasing order.protected static double[] computeDividedDifference(double[] x, double[] y)
The divided difference array is defined recursively by
f[x0] = f(x0) f[x0,x1,...,xk] = (f[x1,...,xk] - f[x0,...,x[k-1]]) / (xk - x0)
The computational complexity is O(N^2).
x
- Interpolating points array.y
- Interpolating values array.DimensionMismatchException
- if the array lengths are different.NumberIsTooSmallException
- if the number of points is less than 2.NonMonotonicSequenceException
- if x
is not sorted in strictly increasing order.Copyright © 2019 CNES. All Rights Reserved.