function
Class BasicVectorFunction

java.lang.Object
  extended by function.BasicVectorFunction
All Implemented Interfaces:
Computable, VectorFunction
Direct Known Subclasses:
ApproxModelToVectorFunction, BasicMultiObjectiveDiviner, CaffeToVectorFunction, EC6, VectorFunctionBuilder, ZDTFunction

public abstract class BasicVectorFunction
extends java.lang.Object
implements VectorFunction

Provides methods for functions with vector-valued outputs. As before, the inputs and outputs must be double-valued.

Author:
dgorur

Field Summary
protected static Hypercube DEFAULT_BOUNDS
           
protected static int DEFAULT_INPUT_DIMENSION
           
protected static int DEFAULT_OUTPUT_DIMENSION
           
protected static double VALUE_OUTSIDE_BOUNDS
           
 
Constructor Summary
BasicVectorFunction()
           
 
Method Summary
protected  void checkInputDimension(double[] x)
          Checks the input dimensions of the provided input.
 double[] compute(double[] x)
          Computes the outputs corresponding to the given input.
 void compute(double[][] x, double[][] y)
          Computes the outputs corresponding to the given set of inputs and stores the results in the given array, which cannot be null.
 void compute(double[] x, double[] y)
          Computes the outputs corresponding to the given input, and stores the result in the supplied array.
 cern.colt.matrix.DoubleMatrix1D compute(cern.colt.matrix.DoubleMatrix1D x, cern.colt.matrix.DoubleMatrix1D y)
          Computes the outputs corresponding to the given input, and stores the result in the supplied vector, which cannot be null.
 cern.colt.matrix.DoubleMatrix2D compute(cern.colt.matrix.DoubleMatrix2D X, cern.colt.matrix.DoubleMatrix2D Y)
          Computes the outputs corresponding to the given set of inputs and stores the result in the given array, which cannot be null.
 Hypercube getBounds()
          Returns a Hypercube specifying the domain of this Computable.
 int getInputDimension()
          Returns the number of dimensions accepted by this Computable.
 int getOutputDimension()
          Returns the output dimension for this Computable.
 void init()
          Initialization method.
 boolean isWithinBounds(double[] x)
          Returns true if the given point is within bounds.
protected static void makeBounds()
           
abstract  void quickCompute(double[] x, double[] y)
          Abstract method that all subclasses must implement.
 void quickCompute(cern.colt.matrix.DoubleMatrix2D X, cern.colt.matrix.DoubleMatrix2D Y)
          Applies compute(double[]) on a set of inputs, supplied row-wise in a matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INPUT_DIMENSION

protected static int DEFAULT_INPUT_DIMENSION

DEFAULT_OUTPUT_DIMENSION

protected static int DEFAULT_OUTPUT_DIMENSION

VALUE_OUTSIDE_BOUNDS

protected static double VALUE_OUTSIDE_BOUNDS

DEFAULT_BOUNDS

protected static Hypercube DEFAULT_BOUNDS
Constructor Detail

BasicVectorFunction

public BasicVectorFunction()
Method Detail

makeBounds

protected static void makeBounds()

compute

public double[] compute(double[] x)
Description copied from interface: VectorFunction
Computes the outputs corresponding to the given input.

Specified by:
compute in interface VectorFunction
Parameters:
x - the given input.
Returns:
an array of outputs.

compute

public void compute(double[] x,
                    double[] y)
Description copied from interface: Computable
Computes the outputs corresponding to the given input, and stores the result in the supplied array.

Specified by:
compute in interface Computable
Parameters:
x - the given input.
y - array to hold the result.

compute

public void compute(double[][] x,
                    double[][] y)
Description copied from interface: Computable
Computes the outputs corresponding to the given set of inputs and stores the results in the given array, which cannot be null.

Specified by:
compute in interface Computable
Specified by:
compute in interface VectorFunction
Parameters:
x - the given inputs.
y - array to hold the result.

compute

public cern.colt.matrix.DoubleMatrix1D compute(cern.colt.matrix.DoubleMatrix1D x,
                                               cern.colt.matrix.DoubleMatrix1D y)
Description copied from interface: VectorFunction
Computes the outputs corresponding to the given input, and stores the result in the supplied vector, which cannot be null.

Specified by:
compute in interface VectorFunction
Parameters:
x - the given input.
y - matrix

compute

public cern.colt.matrix.DoubleMatrix2D compute(cern.colt.matrix.DoubleMatrix2D X,
                                               cern.colt.matrix.DoubleMatrix2D Y)
Description copied from interface: VectorFunction
Computes the outputs corresponding to the given set of inputs and stores the result in the given array, which cannot be null.

Specified by:
compute in interface VectorFunction
Parameters:
X - given matrix of inputs.
Y - matrix to hold results.

getBounds

public Hypercube getBounds()
Description copied from interface: Computable
Returns a Hypercube specifying the domain of this Computable.

Specified by:
getBounds in interface Computable
Returns:
the domain of this ScalarFunction.

getInputDimension

public int getInputDimension()
Description copied from interface: Computable
Returns the number of dimensions accepted by this Computable.

Specified by:
getInputDimension in interface Computable
Returns:
the number of dimensions.

getOutputDimension

public int getOutputDimension()
Description copied from interface: Computable
Returns the output dimension for this Computable.

Specified by:
getOutputDimension in interface Computable
Returns:
the number of output dimensions.

init

public void init()
Initialization method.

Specified by:
init in interface VectorFunction

quickCompute

public abstract void quickCompute(double[] x,
                                  double[] y)
Abstract method that all subclasses must implement. This is the core compute method that takes an input double array and returns an output double array.

Specified by:
quickCompute in interface VectorFunction
Parameters:
x - input array.
y - output array.

quickCompute

public void quickCompute(cern.colt.matrix.DoubleMatrix2D X,
                         cern.colt.matrix.DoubleMatrix2D Y)
Applies compute(double[]) on a set of inputs, supplied row-wise in a matrix. Stores the result in the supplied output array. No size-checking is performed.

Specified by:
quickCompute in interface VectorFunction
Parameters:
X - input matrix.
Y - output matrix.

isWithinBounds

public boolean isWithinBounds(double[] x)
Description copied from interface: Computable
Returns true if the given point is within bounds.

Specified by:
isWithinBounds in interface Computable
Parameters:
x - the given point.
Returns:
true if within bounds.

checkInputDimension

protected void checkInputDimension(double[] x)
Checks the input dimensions of the provided input.

Parameters:
x - the given input.