ca.nengo.util.impl
Class Rectifier

java.lang.Object
  extended by ca.nengo.util.impl.Rectifier
All Implemented Interfaces:
VectorGenerator, java.io.Serializable

public class Rectifier
extends java.lang.Object
implements VectorGenerator, java.io.Serializable

Wraps an underlying VectorGenerator, rectifying generated vectors before they are returned.

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
Rectifier(VectorGenerator vg)
           
Rectifier(VectorGenerator vg, boolean positive)
           
 
Method Summary
 float[][] genVectors(int number, int dimension)
          The vector distribution is decided by implementing classes.
 boolean getPositive()
           
 VectorGenerator getRectified()
           
 void setPositive(boolean positive)
           
 void setRectified(VectorGenerator vg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rectifier

public Rectifier(VectorGenerator vg)
Parameters:
vg - A VectorGenerator to underlie this one (ie to produce non-rectified vectors)

Rectifier

public Rectifier(VectorGenerator vg,
                 boolean positive)
Parameters:
vg - A VectorGenerator to underlie this one (ie to produce non-rectified vectors)
positive - True: vectors are rectified; false: vectors are anti-rectified
Method Detail

getRectified

public VectorGenerator getRectified()
Returns:
Underlying vector generator (output of which is rectified)

setRectified

public void setRectified(VectorGenerator vg)
Parameters:
vg - New underlying vector generator (output of which is to be rectified)

getPositive

public boolean getPositive()
Returns:
True if values are rectified to be >= 0; false if rectified to <= 0

setPositive

public void setPositive(boolean positive)
Parameters:
positive - True if values are rectified to be >= 0; false if rectified to <= 0

genVectors

public float[][] genVectors(int number,
                            int dimension)
Description copied from interface: VectorGenerator
The vector distribution is decided by implementing classes.

Specified by:
genVectors in interface VectorGenerator
Parameters:
number - Number of vectors to be returned
dimension - Dimension of the vectors to be returned
Returns:
Rectified version of vector generated by underlying VectorGenerator (all components -> abs value)
See Also:
VectorGenerator.genVectors(int, int)