ca.nengo.math.impl
Class IdentityFunction

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

public class IdentityFunction
extends java.lang.Object
implements Function

Identity function on a particular dimension of input, ie f(x) = x_i, where i is a constant.

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
IdentityFunction()
          Defaults to one dimension.
IdentityFunction(int dimension, int i)
           
 
Method Summary
 Function clone()
           
 int getDimension()
           
 int getIdentityDimension()
           
 float map(float[] from)
           
 float[] multiMap(float[][] from)
           
 void setDimension(int dimension)
           
 void setIdentityDimension(int i)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityFunction

public IdentityFunction(int dimension,
                        int i)
Parameters:
dimension - Dimension of input vector
i - Index (from 0) of input vector of which this function is an identity

IdentityFunction

public IdentityFunction()
Defaults to one dimension.

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()

setDimension

public void setDimension(int dimension)
Parameters:
dimension - New dimension of expected input vectors

getIdentityDimension

public int getIdentityDimension()
Returns:
Index on input vector of which this funciton is an identity

setIdentityDimension

public void setIdentityDimension(int i)
Parameters:
i - Index (from 0) of input vector of which this function is an identity

map

public 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