distribution
Class BasicMultivariateDistribution

java.lang.Object
  extended by distribution.BasicMultivariateDistribution
All Implemented Interfaces:
MultivariateDistribution
Direct Known Subclasses:
BasicMultivariateMixture, MultivariateNormal, Uniform

public abstract class BasicMultivariateDistribution
extends java.lang.Object
implements MultivariateDistribution

Abstract class that implements most of the convenience methods in MultivariateDistribution. Subclasses only need implement MultivariateDistribution.densityAt(double[]) and MultivariateDistribution.nextSample(double[]) to complete the implementation. They may, however, want to override one or more of the methods here for performance reasons.

Author:
dgorur

Field Summary
protected  cern.jet.random.engine.RandomEngine randomEngine
           
 
Constructor Summary
BasicMultivariateDistribution()
           
 
Method Summary
 void densityAt(double[][] x, double[] p)
          Computes the density at the points that make up the rows of the input array, and places the result in the supplied array.
 double densityAt(cern.colt.matrix.DoubleMatrix1D x)
          Computes the density at the given point.
 cern.colt.matrix.DoubleMatrix1D densityAt(cern.colt.matrix.DoubleMatrix2D x)
          Computes the density at the points comprising the rows of the input matrix, and returns a newly-created vector holding the result.
 cern.colt.matrix.DoubleMatrix1D densityAt(cern.colt.matrix.DoubleMatrix2D x, cern.colt.matrix.DoubleMatrix1D p)
          Computes the density at the points comprising the rows of the input matrix, and places the result in the supplied vector.
 int getInputDimension()
          Returns the number of dimensions of this distribution
 cern.colt.matrix.DoubleMatrix1D makeNextSample()
          Creates and returns a vector holding the next random sample.
 cern.colt.matrix.DoubleMatrix2D makeNextSample(int numSamples)
          Creates and returns a matrix holding the next numSamples random samples.
 void nextSample(double[][] arr)
          Generates the next m random samples of this distribution and places the result in the supplied array.
 cern.colt.matrix.DoubleMatrix1D nextSample(cern.colt.matrix.DoubleMatrix1D vec)
          Generates the next random sample of this distribution and places the result in the supplied vector.
 cern.colt.matrix.DoubleMatrix2D nextSample(cern.colt.matrix.DoubleMatrix2D mat)
          Generates the next m random samples of this distribution and places the result in the supplied matrix.
 void setInputDimension(int inputDimension)
          Sets the number of dimensions of this distribution
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface distribution.MultivariateDistribution
densityAt, nextSample, setSeed
 

Field Detail

randomEngine

protected cern.jet.random.engine.RandomEngine randomEngine
Constructor Detail

BasicMultivariateDistribution

public BasicMultivariateDistribution()
Method Detail

densityAt

public void densityAt(double[][] x,
                      double[] p)
Description copied from interface: MultivariateDistribution
Computes the density at the points that make up the rows of the input array, and places the result in the supplied array.

Specified by:
densityAt in interface MultivariateDistribution
Parameters:
x - array whose rows are the points where density is desired.
p - array to hold the result, cannot be null.

densityAt

public double densityAt(cern.colt.matrix.DoubleMatrix1D x)
Description copied from interface: MultivariateDistribution
Computes the density at the given point.

Specified by:
densityAt in interface MultivariateDistribution
Parameters:
x - the given point
Returns:
the density at the given point.

densityAt

public cern.colt.matrix.DoubleMatrix1D densityAt(cern.colt.matrix.DoubleMatrix2D x)
Description copied from interface: MultivariateDistribution
Computes the density at the points comprising the rows of the input matrix, and returns a newly-created vector holding the result.

Specified by:
densityAt in interface MultivariateDistribution
Parameters:
x - matrix whose rows comprise the points where density is desired.

densityAt

public cern.colt.matrix.DoubleMatrix1D densityAt(cern.colt.matrix.DoubleMatrix2D x,
                                                 cern.colt.matrix.DoubleMatrix1D p)
Description copied from interface: MultivariateDistribution
Computes the density at the points comprising the rows of the input matrix, and places the result in the supplied vector.

Specified by:
densityAt in interface MultivariateDistribution
Parameters:
x - matrix whose rows are the points where density is desired.
p - vector to hold the result, cannot be null.
Returns:
pointer to the result vector, for convenience.

getInputDimension

public int getInputDimension()
Description copied from interface: MultivariateDistribution
Returns the number of dimensions of this distribution

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

makeNextSample

public cern.colt.matrix.DoubleMatrix1D makeNextSample()
Description copied from interface: MultivariateDistribution
Creates and returns a vector holding the next random sample.

Specified by:
makeNextSample in interface MultivariateDistribution
Returns:
a new vector holding the next random sample.

makeNextSample

public cern.colt.matrix.DoubleMatrix2D makeNextSample(int numSamples)
Description copied from interface: MultivariateDistribution
Creates and returns a matrix holding the next numSamples random samples.

Specified by:
makeNextSample in interface MultivariateDistribution
Parameters:
numSamples - the number of samples desired.
Returns:
a new matrix holding the next numSamples samples.

nextSample

public void nextSample(double[][] arr)
Description copied from interface: MultivariateDistribution
Generates the next m random samples of this distribution and places the result in the supplied array. the number m is inferred from the number of rows in the supplied array.

Specified by:
nextSample in interface MultivariateDistribution
Parameters:
arr - array to hold the result, cannot be null.

nextSample

public cern.colt.matrix.DoubleMatrix1D nextSample(cern.colt.matrix.DoubleMatrix1D vec)
Description copied from interface: MultivariateDistribution
Generates the next random sample of this distribution and places the result in the supplied vector. Returns a pointer to the same vector for convenience.

Specified by:
nextSample in interface MultivariateDistribution
Parameters:
vec - vector to hold the result. Cannot be null. Use MultivariateDistribution.makeNextSample() if the sample needs to be created from scratch.
Returns:
pointer to the same vector, for convenience.

nextSample

public cern.colt.matrix.DoubleMatrix2D nextSample(cern.colt.matrix.DoubleMatrix2D mat)
Description copied from interface: MultivariateDistribution
Generates the next m random samples of this distribution and places the result in the supplied matrix. Returns a pointer to the same matrix for convenience.

Specified by:
nextSample in interface MultivariateDistribution
Parameters:
mat - matrix to hold the result. Cannot be null
Returns:
a pointer to the same matrix, for convenience. Use MultivariateDistribution.makeNextSample(int) to creates samples from scratch.

setInputDimension

public void setInputDimension(int inputDimension)
Description copied from interface: MultivariateDistribution
Sets the number of dimensions of this distribution

Specified by:
setInputDimension in interface MultivariateDistribution
Parameters:
inputDimension - the given number of dimensions.