model
Class BasicCorrelationFunction

java.lang.Object
  extended by model.BasicCorrelationFunction
All Implemented Interfaces:
VariableInputDimension
Direct Known Subclasses:
DifferentiableCorrelationFunction

public abstract class BasicCorrelationFunction
extends java.lang.Object
implements VariableInputDimension

Basic implementation of a correlation function for GPs.

Author:
dgorur

Nested Class Summary
static class BasicCorrelationFunction.TYPE
          Encodes correlation function types: EXP = exponential, SE = squred exponential, default is SE>
 
Field Summary
protected  cern.colt.matrix.DoubleMatrix1D tauVec
           
 
Constructor Summary
BasicCorrelationFunction()
          Default constructor.
 
Method Summary
abstract  double apply(cern.colt.matrix.DoubleMatrix1D x1, cern.colt.matrix.DoubleMatrix1D x2)
          Computes the correlation between the outputs at x1 and x2.
 cern.colt.matrix.DoubleMatrix1D apply(cern.colt.matrix.DoubleMatrix1D x1, cern.colt.matrix.DoubleMatrix2D x2)
          Computes the correlation between the output at a given input location x1 and those at a set of other input locations x2.
 cern.colt.matrix.DoubleMatrix1D apply(cern.colt.matrix.DoubleMatrix1D x1, cern.colt.matrix.DoubleMatrix2D x2, cern.colt.matrix.DoubleMatrix1D ans)
          Same as apply(DoubleMatrix1D, DoubleMatrix2D), but stores the result in the supplied vector.
 cern.colt.matrix.DoubleMatrix2D apply(cern.colt.matrix.DoubleMatrix2D x1, cern.colt.matrix.DoubleMatrix2D x2)
          Computes the correlation between outputs at input locations x1 and x2.
 cern.colt.matrix.DoubleMatrix2D apply(cern.colt.matrix.DoubleMatrix2D x1, cern.colt.matrix.DoubleMatrix2D x2, cern.colt.matrix.DoubleMatrix2D ans)
          Same as apply(DoubleMatrix2D, DoubleMatrix2D), but stores the result in the supplied matrix.
 int getInputDimension()
          Returns the input dimension.
static BasicCorrelationFunction getInstance(BasicCorrelationFunction.TYPE type, int inputDimension)
          Creates and returns a correlation function instance, by default the squared exponential one.
static BasicCorrelationFunction getInstance(int inputDimension)
          Returns an instance of an SE correlation function in the given number of dimensions.
 double[] getTau()
          Returns the length-scale parameter array tau.
 void setInputDimension(int inputDimension)
          Sets the input dimension.
 void setTau(double[] tau)
          Sets the length-scale parameter array tau.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tauVec

protected cern.colt.matrix.DoubleMatrix1D tauVec
Constructor Detail

BasicCorrelationFunction

public BasicCorrelationFunction()
Default constructor.

Method Detail

getInstance

public static BasicCorrelationFunction getInstance(BasicCorrelationFunction.TYPE type,
                                                   int inputDimension)
Creates and returns a correlation function instance, by default the squared exponential one.

Parameters:
type - the BasicCorrelationFunction.TYPE of correlation function to create.
inputDimension - the input dimension.
Returns:
an instance of the given type of correlation function.

getInstance

public static BasicCorrelationFunction getInstance(int inputDimension)
Returns an instance of an SE correlation function in the given number of dimensions.

Parameters:
inputDimension - the given number of dimensions.
Returns:
an SE correlation function in the given number of dimensions.

apply

public abstract double apply(cern.colt.matrix.DoubleMatrix1D x1,
                             cern.colt.matrix.DoubleMatrix1D x2)
Computes the correlation between the outputs at x1 and x2.

Parameters:
x1 - an input location.
x2 - another input location.
Returns:
the correlation between outputs at these two locations.

apply

public cern.colt.matrix.DoubleMatrix1D apply(cern.colt.matrix.DoubleMatrix1D x1,
                                             cern.colt.matrix.DoubleMatrix2D x2)
Computes the correlation between the output at a given input location x1 and those at a set of other input locations x2. Creates a vector to hold the result.

Parameters:
x1 - the given input location.
x2 - a set of input locations.
Returns:
the correlation between the output at x1 and those at x2.

apply

public cern.colt.matrix.DoubleMatrix1D apply(cern.colt.matrix.DoubleMatrix1D x1,
                                             cern.colt.matrix.DoubleMatrix2D x2,
                                             cern.colt.matrix.DoubleMatrix1D ans)
Same as apply(DoubleMatrix1D, DoubleMatrix2D), but stores the result in the supplied vector.

Parameters:
x1 - an input location.
x2 - a given set of input locations.
ans - vector to hold the result.
Returns:
ans for convenience.

apply

public cern.colt.matrix.DoubleMatrix2D apply(cern.colt.matrix.DoubleMatrix2D x1,
                                             cern.colt.matrix.DoubleMatrix2D x2)
Computes the correlation between outputs at input locations x1 and x2. Creates a matrix to hold the results.

Parameters:
x1 - one set of input locations.
x2 - another set of input locations.
Returns:
the correlation between the outputs at these two sets of input locations.

apply

public cern.colt.matrix.DoubleMatrix2D apply(cern.colt.matrix.DoubleMatrix2D x1,
                                             cern.colt.matrix.DoubleMatrix2D x2,
                                             cern.colt.matrix.DoubleMatrix2D ans)
Same as apply(DoubleMatrix2D, DoubleMatrix2D), but stores the result in the supplied matrix.

Parameters:
x1 - a set of input locations.
x2 - another set of input locations.
ans - matrix to hold the result.
Returns:
ans for convenience.

getInputDimension

public int getInputDimension()
Returns the input dimension.

Returns:
the input dimension.

getTau

public double[] getTau()
Returns the length-scale parameter array tau.

Returns:
the length-scale parameter array.

setInputDimension

public void setInputDimension(int inputDimension)
Sets the input dimension.

Specified by:
setInputDimension in interface VariableInputDimension
Parameters:
inputDimension - the given input dimension.

setTau

public void setTau(double[] tau)
Sets the length-scale parameter array tau.

Parameters:
tau - the given length scales.