Class Interpolate
java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.from_long.to_double.Interpolate
- All Implemented Interfaces:
LongToDoubleFunction
- Direct Known Subclasses:
EmpiricalDistribution
Return a value along an interpolation curve. This allows you to sketch a basic
density curve and describe it simply with just a few values. The number of values
provided determines the resolution of the internal lookup table that is used for
interpolation. The first value is always the 0.0 anchoring point on the unit interval.
The last value is always the 1.0 anchoring point on the unit interval. This means
that in order to subdivide the density curve in an interesting way, you need to provide
a few more values in between them. Providing two values simply provides a uniform
sample between a minimum and maximum value.
The input range of this function is, as many of the other functions in this library,
based on the valid range of positive long values, between 0L and Long.MAX_VALUE inclusive.
This means that if you want to combine interpolation on this curve with the effect of
pseudo-random sampling, you need to put a hash function ahead of it in the flow.
Developer Note: This is the canonical implementation of LERPing in NoSQLBench, so is
heavily documented. Any other LERP implementations should borrow directly from this,
embedding by default.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
lut
public final double[] lut
-
-
Constructor Details
-
Interpolate
public Interpolate(double... values)
-
-
Method Details
-
applyAsDouble
public double applyAsDouble(long input) - Specified by:
applyAsDoublein interfaceLongToDoubleFunction
-