ca.nengo.math.impl
Class ConstantFunction

java.lang.Object
  extended by ca.nengo.math.impl.ConstantFunction
All Implemented Interfaces:
Function, java.io.Serializable, java.lang.Cloneable

public class ConstantFunction
extends java.lang.Object
implements Function

A Function that maps everything to the same value.

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
ConstantFunction(int dimension, float value)
           
 
Method Summary
 Function clone()
           
 int getDimension()
           
 float getValue()
           
 float map(float[] from)
           
 float[] multiMap(float[][] from)
           
 void setDimension(int dimension)
           
 void setValue(float value)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantFunction

public ConstantFunction(int dimension,
                        float value)
Parameters:
dimension - Input dimension of this Function
value - Constant output value of this Function
Method Detail

setValue

public void setValue(float value)
Parameters:
value - The new constant result of the function

setDimension

public void setDimension(int dimension)
Parameters:
dimension - New dimension

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 float map(float[] from)
Specified by:
map in interface Function
Parameters:
from - Must have same length as getDimension()
Returns:
The constant value given in the constructor
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[][])

getValue

public float getValue()
Returns:
Value of function

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