Class LinearInterpolator
java.lang.Object
org.hipparchus.analysis.interpolation.LinearInterpolator
- All Implemented Interfaces:
FieldUnivariateInterpolator
,UnivariateInterpolator
public class LinearInterpolator
extends Object
implements UnivariateInterpolator, FieldUnivariateInterpolator
Implements a linear function for interpolation of real univariate functions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioninterpolate
(double[] x, double[] y) Computes a linear interpolating function for the data set.<T extends CalculusFieldElement<T>>
FieldPolynomialSplineFunction<T>interpolate
(T[] x, T[] y) Computes a linear interpolating function for the data set.
-
Constructor Details
-
LinearInterpolator
public LinearInterpolator()Empty constructor.This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.
- Since:
- 3.0
-
-
Method Details
-
interpolate
public PolynomialSplineFunction interpolate(double[] x, double[] y) throws MathIllegalArgumentException Computes a linear interpolating function for the data set.- Specified by:
interpolate
in interfaceUnivariateInterpolator
- Parameters:
x
- the arguments for the interpolation pointsy
- the values for the interpolation points- Returns:
- a function which interpolates the data set
- Throws:
MathIllegalArgumentException
- ifx
andy
have different sizes.MathIllegalArgumentException
- ifx
is not sorted in strict increasing order.MathIllegalArgumentException
- if the size ofx
is smaller than 2.
-
interpolate
public <T extends CalculusFieldElement<T>> FieldPolynomialSplineFunction<T> interpolate(T[] x, T[] y) throws MathIllegalArgumentException Computes a linear interpolating function for the data set.- Specified by:
interpolate
in interfaceFieldUnivariateInterpolator
- Type Parameters:
T
- the type of the field elements- Parameters:
x
- the arguments for the interpolation pointsy
- the values for the interpolation points- Returns:
- a function which interpolates the data set
- Throws:
MathIllegalArgumentException
- ifx
andy
have different sizes.MathIllegalArgumentException
- ifx
is not sorted in strict increasing order.MathIllegalArgumentException
- if the size ofx
is smaller than 2.- Since:
- 1.5
-