com.metsci.glimpse.util.math.fast
Class FastFunc

java.lang.Object
  extended by 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 java.lang.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
FastFunc(double min, double max, int nSamples)
          Main Constructor in which the values of this function are computed
 
Method Summary
 double evaluate(double x)
           
 double lookup(double x)
          Returns the value of the precomputed function using a simple nearest neighbor interpolation.
 void lookup(double[][] A, double[][] x)
          Returns the value of the precomputed function using a simple nearest neighbor interpolation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastFunc

public FastFunc(double min,
                double max,
                int nSamples)
Main Constructor in which the values of this function are computed

Parameters:
min - minimum value to sample
max - maximum value to sample
samples - number of samples
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 values
x - arguments

evaluate

public double evaluate(double x)


Copyright © 2012 Metron, Inc.. All Rights Reserved.