Class FastFunc
- java.lang.Object
-
- com.metsci.glimpse.util.math.fast.FastFunc
-
- Direct Known Subclasses:
FastAcos,FastAsin,FastExp,FastExp2,FastFuncUnboundedDomain,FastGaussian,FastLog,FastLog10,FastSigmoid,FastSin,FastUnscaledGaussian
public abstract class FastFunc extends Object
A function that precomputes its values for speed. Intended to accelerate the evaluation of transcendental functions in cases where speed is more important than accuracy. To implement a particular precomputed function, extend this abstract class and implement the method that evaluates the function.- Author:
- ellis
-
-
Constructor Summary
Constructors Constructor Description FastFunc(double min, double max, int nSamples)Main Constructor in which the values of this function are computed
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleevaluate(double x)doublelookup(double x)Returns the value of the precomputed function using a simple nearest neighbor interpolation.voidlookup(double[][] A, double[][] x)Returns the value of the precomputed function using a simple nearest neighbor interpolation.
-
-
-
Method Detail
-
lookup
public double lookup(double x)
Returns the value of the precomputed function using a simple nearest neighbor interpolation.- Parameters:
x- function argument (you must ensure this is in range)- Returns:
- value of the function
-
lookup
public void lookup(double[][] A, double[][] x)Returns the value of the precomputed function using a simple nearest neighbor interpolation. size(A) should = size(x).- Parameters:
A- function valuesx- arguments
-
evaluate
public double evaluate(double x)
-
-