ca.nengo.math.impl
Class AbstractFunction

java.lang.Object
  extended by ca.nengo.math.impl.AbstractFunction
All Implemented Interfaces:
Function, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractRealLearningFunction, AbstractSpikeLearningFunction, Convolution, ExponentialPDF, FunctionBasisImpl, LinearCurveFitter.InterpolatedFunction, LinearFunction, PiecewiseConstantFunction, PoissonPDF, Polynomial, RateFunctionSpikeGenerator.PoiraziDendriteSigmoid, RateFunctionSpikeGenerator.PoiraziSomaSigmoid, SigmoidFunction, SimpleFunctions.Acos, SimpleFunctions.Asin, SimpleFunctions.Atan, SimpleFunctions.Cos, SimpleFunctions.Exp, SimpleFunctions.Fold, SimpleFunctions.InverseNormal, SimpleFunctions.Ln, SimpleFunctions.Log10, SimpleFunctions.Log2, SimpleFunctions.Max, SimpleFunctions.Min, SimpleFunctions.Normal, SimpleFunctions.Pow, SimpleFunctions.Sin, SimpleFunctions.Sqrt, SimpleFunctions.Tan, TimeSeriesFunction

public abstract class AbstractFunction
extends java.lang.Object
implements Function

Base class for Function implementations. The default implementation of multiMap() calls map(). This will be a little slower than if both methods were to call a static function, so if multiMap speed is an issue this method could be overridden, or it might be better not to use this abstract class.

Author:
Bryan Tripp
See Also:
Serialized Form

Field Summary
static java.lang.String DIMENSION_PROPERTY
           
 
Constructor Summary
AbstractFunction(int dim)
           
 
Method Summary
 Function clone()
           
 int getDimension()
           
abstract  float map(float[] from)
           
 float[] multiMap(float[][] from)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIMENSION_PROPERTY

public static final java.lang.String DIMENSION_PROPERTY
See Also:
Constant Field Values
Constructor Detail

AbstractFunction

public AbstractFunction(int dim)
Parameters:
dim - Input dimension of the function
Method Detail

getDimension

public int getDimension()
Specified by:
getDimension in interface Function
Returns:
Dimension of the space that the Function maps from
See Also:
Function.getDimension()

map

public abstract float map(float[] from)
Specified by:
map in interface Function
Parameters:
from - Must have same length as getDimension()
Returns:
result of function operation on arg
See Also:
Function.map(float[])

multiMap

public float[] multiMap(float[][] from)
Specified by:
multiMap in interface Function
Parameters:
from - An array of arguments; each element must have length getDimension().
Returns:
Array of results of function operation on each arg
See Also:
Function.multiMap(float[][])

clone

public Function clone()
               throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Function
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()