Nengo.ca

ca.nengo.math.impl
Class LinearFunction

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

public class LinearFunction
extends AbstractFunction

A linear map into one dimension. Optionally, the result can be biased and/or rectified.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class ca.nengo.math.impl.AbstractFunction
DIMENSION_PROPERTY
 
Constructor Summary
LinearFunction(float[] map, float bias, boolean rectified)
           
 
Method Summary
 Function clone()
           
 float getBias()
           
 float[] getMap()
           
 boolean getRectified()
           
 float map(float[] from)
           
 void setBias(float bias)
           
 void setMap(float[] map)
           
 void setRectified(boolean rectified)
           
 
Methods inherited from class ca.nengo.math.impl.AbstractFunction
getCode, getDimension, getName, multiMap, setCode, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearFunction

public LinearFunction(float[] map,
                      float bias,
                      boolean rectified)
Parameters:
map - A 1Xn matrix that defines a map from input onto one dimension (i.e. f(x) = m'x, where m is the map)
bias - Bias to add to result
rectified - If true, result is rectified (set to 0 if less than 0)
Method Detail

getMap

public float[] getMap()
Returns:
map A 1Xn matrix that defines a map from input onto one dimension (i.e. f(x) = m'x, where m is the map)

setMap

public void setMap(float[] map)
Parameters:
map - map A 1Xn matrix that defines a map from input onto one dimension (i.e. f(x) = m'x, where m is the map)

getBias

public float getBias()
Returns:
Bias to add to result

setBias

public void setBias(float bias)
Parameters:
bias - Bias to add to result

getRectified

public boolean getRectified()
Returns:
If true, result is rectified (set to 0 if less than 0)

setRectified

public void setRectified(boolean rectified)
Parameters:
rectified - If true, result is rectified (set to 0 if less than 0)

map

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

clone

public Function clone()
               throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Function
Overrides:
clone in class AbstractFunction
Returns:
Valid clone
Throws:
java.lang.CloneNotSupportedException - is super does not support clone

Nengo.ca