Package xal.extension.fit
Class LinearInterpolator
java.lang.Object
xal.extension.fit.LinearInterpolator
LinearInterpolator calculates the linear interpolated value at at any point
within the bounds of an array of values.
- Author:
- tap
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLinearInterpolator
(double[] values, double start, double step) Creates a new instance of Interpolator. -
Method Summary
Modifier and TypeMethodDescriptiondouble
calcValueAt
(double point) Calculate the interpolated value at the specified point in the domain.
-
Field Details
-
values
protected final double[] values -
start
protected final double start -
step
protected final double step
-
-
Constructor Details
-
LinearInterpolator
public LinearInterpolator(double[] values, double start, double step) Creates a new instance of Interpolator.- Parameters:
values
- is the array of values at fixed intervals.start
- is the start of the domain of points and corresponds to the first array elementstep
- is the step in the domain for each successive element in the array
-
-
Method Details
-
calcValueAt
Calculate the interpolated value at the specified point in the domain. The point must reside within the domain of points fromstart
tostart + step * values.length
.- Parameters:
point
- The point in the domain for which we should interpolate the value.- Returns:
- The interpolated value.
- Throws:
ArrayIndexOutOfBoundsException
- if the point does not fall int the accepted domain
-