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
Constructors Constructor Description LinearInterpolator()Empty constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PolynomialSplineFunctioninterpolate(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.
-
-
-
Method Detail
-
interpolate
public PolynomialSplineFunction interpolate(double[] x, double[] y) throws MathIllegalArgumentException
Computes a linear interpolating function for the data set.- Specified by:
interpolatein 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- ifxandyhave different sizes.MathIllegalArgumentException- ifxis not sorted in strict increasing order.MathIllegalArgumentException- if the size ofxis 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:
interpolatein 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- ifxandyhave different sizes.MathIllegalArgumentException- ifxis not sorted in strict increasing order.MathIllegalArgumentException- if the size ofxis smaller than 2.- Since:
- 1.5
-
-