Class FieldInterpolator<C,V>
- java.lang.Object
-
- org.tensorics.core.scalar.lang.ScalarSupport<V>
-
- org.tensorics.core.tensor.resample.impl.FieldInterpolator<C,V>
-
- Type Parameters:
C
- the type of the coordinate (x-values)V
- the type of the field elements (y-values of the 1-D discrete function to interpolate
- All Implemented Interfaces:
BasicOperationSupport<V>
public class FieldInterpolator<C,V> extends ScalarSupport<V>
Takes a discrete set of x-values (being of type C - one coordinate of a tensor) and a transformation function of C to V together with a callback function to Y values (of type V - the elements of a field) corresponding to the given X values, and tries to determine a y-value for a given x-value by interpolating between the two neighbouring points. The main purpose of this class is encapsulation for reusage and avoiding to avoid pass around a lot of parameters.
-
-
Constructor Summary
Constructors Constructor Description FieldInterpolator(ExtendedField<V> field, java.util.Collection<C> coordinates, java.util.function.Function<C,V> xConversion, java.util.function.Function<C,V> yFunction, C x)
Constructor, taking all the parameters required for the calculation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
calculate()
Performs the actual calculation of interpolation.-
Methods inherited from class org.tensorics.core.scalar.lang.ScalarSupport
absoluteValueOf, calculate, countOf, field, inverseOf, negativeOf, one, squareOf, squareRootOf, testIf, two, zero
-
-
-
-
Constructor Detail
-
FieldInterpolator
public FieldInterpolator(ExtendedField<V> field, java.util.Collection<C> coordinates, java.util.function.Function<C,V> xConversion, java.util.function.Function<C,V> yFunction, C x)
Constructor, taking all the parameters required for the calculation- Parameters:
field
- the field of elements of type V, which is required to do the calculation for the interpolation and to have a comparator available.coordinates
- the discrete set of coordinates, which represent the support points for the interpolationxConversion
- a conversion function to convert x-values into the type V. This function has to be defined for each value of coordinates and x.yFunction
- the function providing the y-values corresponding to each x-value. This function has to be defined for each value of coordinates (not for x, as otherwise interpolation would not be required).x
- the point at which the y-value shall be determined.- Throws:
java.lang.NullPointerException
- in case any of the given parameters isnull
-
-
Method Detail
-
calculate
public V calculate()
Performs the actual calculation of interpolation.- Returns:
- the interpolated value at x
-
-