gpalta.core
Class TempVectorFactory

java.lang.Object
  extended by gpalta.core.TempVectorFactory

public class TempVectorFactory
extends java.lang.Object

Hold arrays in which the nodes will be evaluated (when using evalVect). This is done to avoid allocating memory every time a node is evaluated, greatly improving execution speed with large data sets


Constructor Summary
TempVectorFactory(int vectorSize)
          Creates a new instance of TempVectorFactory
 
Method Summary
 double[] get()
          Get a new array.
 void release()
          Tell that the latest requested array is no longer needed by the Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempVectorFactory

public TempVectorFactory(int vectorSize)
Creates a new instance of TempVectorFactory

Parameters:
vectorSize - The size of each array (number of samples)
Method Detail

get

public double[] get()
Get a new array. If previously allocated outputs are available (not already in use), it will return one of them. Else, it will allocate memory for a new one


release

public void release()
Tell that the latest requested array is no longer needed by the Node. The Node that requested an array must release it inmediately after stopping using it, or every time a node of that kind is evaluated, an output will be created and never released, leading to HUGE MEMORY LEAKS.