Class AkimaSplineInterpolator
- java.lang.Object
-
- org.hipparchus.analysis.interpolation.AkimaSplineInterpolator
-
- All Implemented Interfaces:
FieldUnivariateInterpolator,UnivariateInterpolator
public class AkimaSplineInterpolator extends Object implements UnivariateInterpolator, FieldUnivariateInterpolator
Computes a cubic spline interpolation for the data set using the Akima algorithm, as originally formulated by Hiroshi Akima in his 1970 paper "A New Method of Interpolation and Smooth Curve Fitting Based on Local Procedures." J. ACM 17, 4 (October 1970), 589-602. DOI=10.1145/321607.321609 http://doi.acm.org/10.1145/321607.321609This implementation is based on the Akima implementation in the CubicSpline class in the Math.NET Numerics library. The method referenced is CubicSpline.InterpolateAkimaSorted
The
interpolatemethod returns aPolynomialSplineFunctionconsisting of n cubic polynomials, defined over the subintervals determined by the x values,x[0] < x[i] ... < x[n]. The Akima algorithm requires thatn >= 5.
-
-
Constructor Summary
Constructors Constructor Description AkimaSplineInterpolator()Simple constructor.AkimaSplineInterpolator(boolean useModifiedWeights)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PolynomialSplineFunctioninterpolate(double[] xvals, double[] yvals)Computes an interpolating function for the data set.<T extends CalculusFieldElement<T>>
FieldPolynomialSplineFunction<T>interpolate(T[] xvals, T[] yvals)Computes an interpolating function for the data set.
-
-
-
Constructor Detail
-
AkimaSplineInterpolator
public AkimaSplineInterpolator()
Simple constructor.This constructor is equivalent to call
AkimaSplineInterpolator(false), i.e. to use original Akima weights- Since:
- 2.1
-
AkimaSplineInterpolator
public AkimaSplineInterpolator(boolean useModifiedWeights)
Simple constructor.The weight modification is described in Makima Piecewise Cubic Interpolation. It attempts to avoid overshoots near near constant slopes sub-samples.
- Parameters:
useModifiedWeights- if true, use modified weights to avoid overshoots- Since:
- 2.1
-
-
Method Detail
-
interpolate
public PolynomialSplineFunction interpolate(double[] xvals, double[] yvals) throws MathIllegalArgumentException
Computes an interpolating function for the data set.- Specified by:
interpolatein interfaceUnivariateInterpolator- Parameters:
xvals- the arguments for the interpolation pointsyvals- the values for the interpolation points- Returns:
- a function which interpolates the data set
- Throws:
MathIllegalArgumentException- ifxvalsandyvalshave different sizes.MathIllegalArgumentException- ifxvalsis not sorted in strict increasing order.MathIllegalArgumentException- if the size ofxvalsis smaller than 5.
-
interpolate
public <T extends CalculusFieldElement<T>> FieldPolynomialSplineFunction<T> interpolate(T[] xvals, T[] yvals) throws MathIllegalArgumentException
Computes an interpolating function for the data set.- Specified by:
interpolatein interfaceFieldUnivariateInterpolator- Type Parameters:
T- the type of the field elements- Parameters:
xvals- the arguments for the interpolation pointsyvals- the values for the interpolation points- Returns:
- a function which interpolates the data set
- Throws:
MathIllegalArgumentException- ifxvalsandyvalshave different sizes.MathIllegalArgumentException- ifxvalsis not sorted in strict increasing order.MathIllegalArgumentException- if the size ofxvalsis smaller than 5.- Since:
- 1.5
-
-