public class AkimaSplineInterpolator extends Object implements UnivariateInterpolator, FieldUnivariateInterpolator
This implementation is based on the Akima implementation in the CubicSpline class in the Math.NET Numerics library. The method referenced is CubicSpline.InterpolateAkimaSorted
The interpolate
method returns a
PolynomialSplineFunction
consisting of n cubic polynomials, defined
over the subintervals determined by the x values, x[0] < x[i] ... < x[n]
.
The Akima algorithm requires that n >= 5
.
Constructor and Description |
---|
AkimaSplineInterpolator()
Simple constructor.
|
AkimaSplineInterpolator(boolean useModifiedWeights)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
PolynomialSplineFunction |
interpolate(double[] xvals,
double[] yvals)
Computes an interpolating function for the data set.
|
<T extends CalculusFieldElement<T>> |
interpolate(T[] xvals,
T[] yvals)
Computes an interpolating function for the data set.
|
public AkimaSplineInterpolator()
This constructor is equivalent to call AkimaSplineInterpolator(false)
, i.e. to use original Akima weights
public AkimaSplineInterpolator(boolean useModifiedWeights)
The weight modification is described in Makima Piecewise Cubic Interpolation. It attempts to avoid overshoots near near constant slopes sub-samples.
useModifiedWeights
- if true, use modified weights to avoid overshootspublic PolynomialSplineFunction interpolate(double[] xvals, double[] yvals) throws MathIllegalArgumentException
interpolate
in interface UnivariateInterpolator
xvals
- the arguments for the interpolation pointsyvals
- the values for the interpolation pointsMathIllegalArgumentException
- if xvals
and yvals
have
different sizes.MathIllegalArgumentException
- if xvals
is not sorted in
strict increasing order.MathIllegalArgumentException
- if the size of xvals
is smaller
than 5.public <T extends CalculusFieldElement<T>> FieldPolynomialSplineFunction<T> interpolate(T[] xvals, T[] yvals) throws MathIllegalArgumentException
interpolate
in interface FieldUnivariateInterpolator
T
- the type of the field elementsxvals
- the arguments for the interpolation pointsyvals
- the values for the interpolation pointsMathIllegalArgumentException
- if xvals
and yvals
have
different sizes.MathIllegalArgumentException
- if xvals
is not sorted in
strict increasing order.MathIllegalArgumentException
- if the size of xvals
is smaller
than 5.Copyright © 2016-2022 CS GROUP. All rights reserved.