HMSBEAGLE  1.0.0
Public Member Functions | Static Public Attributes
beagle.Beagle Interface Reference
Inheritance diagram for beagle.Beagle:
beagle.BeagleJNIImpl beagle.GeneralBeagleImpl beagle.DependencyAwareBeagleImpl beagle.FourStateBeagleImpl

List of all members.

Public Member Functions

void finalize () throws Throwable
void setPatternWeights (final double[] patternWeights)
void setTipStates (int tipIndex, final int[] inStates)
void getTipStates (int tipIndex, final int[] outStates)
void setTipPartials (int tipIndex, final double[] inPartials)
void setPartials (int bufferIndex, final double[] inPartials)
void getPartials (int bufferIndex, int scaleIndex, final double[]outPartials)
void setEigenDecomposition (int eigenIndex, final double[] inEigenVectors, final double[] inInverseEigenVectors, final double[] inEigenValues)
void setStateFrequencies (int stateFrequenciesIndex, final double[] stateFrequencies)
void setCategoryWeights (int categoryWeightsIndex, final double[] categoryWeights)
void setCategoryRates (final double[] inCategoryRates)
void updateTransitionMatrices (int eigenIndex, final int[] probabilityIndices, final int[] firstDerivativeIndices, final int[] secondDervativeIndices, final double[] edgeLengths, int count)
void setTransitionMatrix (int matrixIndex, final double[] inMatrix, double paddedValue)
void getTransitionMatrix (int matrixIndex, double[] outMatrix)
void updatePartials (final int[] operations, int operationCount, int cumulativeScaleIndex)
void accumulateScaleFactors (final int[] scaleIndices, final int count, final int cumulativeScaleIndex)
void removeScaleFactors (final int[] scaleIndices, final int count, final int cumulativeScaleIndex)
void copyScaleFactors (int destScalingIndex, int srcScalingIndex)
void resetScaleFactors (int cumulativeScaleIndex)
void calculateRootLogLikelihoods (int[] bufferIndices, int[] categoryWeightsIndices, int[] stateFrequenciesIndices, int[] cumulativeScaleIndices, int count, double[] outSumLogLikelihood)
void calculateEdgeLogLikelihoods (int[] parentBufferIndices, int[] childBufferIndices, int[] probabilityIndices, int[] firstDerivativeIndices, int[] secondDerivativeIndices, int[] categoryWeightsIndices, int[] stateFrequenciesIndices, int[] cumulativeScaleIndices, int count, double[] outSumLogLikelihood, double[] outSumFirstDerivative, double[] outSumSecondDerivative)
void getSiteLogLikelihoods (double[] outLogLikelihoods)
InstanceDetails getDetails ()

Static Public Attributes

static int OPERATION_TUPLE_SIZE = 7
static int NONE = -1

Detailed Description

Beagle - An interface exposing the BEAGLE likelihood evaluation library.

This interface mirrors the beagle.h API but it for a single instance only. It is intended to be used by JNI wrappers of the BEAGLE library and for Java implementations for testing purposes. BeagleFactory handles the creation of specific istances.

Author:
Andrew Rambaut
Marc A. Suchard
Version:
$Id:$

Member Function Documentation

void beagle.Beagle.accumulateScaleFactors ( final int[]  scaleIndices,
final int  count,
final int  cumulativeScaleIndex 
)

Accumulate scale factors

This function adds (log) scale factors from a list of scaleBuffers to a cumulative scale buffer. It is used to calculate the marginal scaling at a specific node for each site.

Parameters:
scaleIndicesList of scaleBuffers to add (input)
countNumber of scaleBuffers in list (input)
cumulativeScaleIndexIndex number of scaleBuffer to accumulate factors into (input)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.calculateEdgeLogLikelihoods ( int[]  parentBufferIndices,
int[]  childBufferIndices,
int[]  probabilityIndices,
int[]  firstDerivativeIndices,
int[]  secondDerivativeIndices,
int[]  categoryWeightsIndices,
int[]  stateFrequenciesIndices,
int[]  cumulativeScaleIndices,
int  count,
double[]  outSumLogLikelihood,
double[]  outSumFirstDerivative,
double[]  outSumSecondDerivative 
)

Calculate site log likelihoods and derivatives along an edge

This function integrates at list of partials at a parent and child node with respect to a set of partials-weights and state frequencies to return the log likelihoods and first and second derivatives for each site

Parameters:
parentBufferIndicesList of indices of parent partialsBuffers (input)
childBufferIndicesList of indices of child partialsBuffers (input)
probabilityIndicesList indices of transition probability matrices for this edge (input)
firstDerivativeIndicesList indices of first derivative matrices (input)
secondDerivativeIndicesList indices of second derivative matrices (input)
categoryWeightsIndicesList of indices of category weights to apply to each partialsBuffer (input)
stateFrequenciesIndicesList of indices of state frequencies for each partialsBuffer (input) There should be one set for each of parentBufferIndices
cumulativeScaleIndicesList of scalingFactors indices to accumulate over (input). There There should be one set for each of parentBufferIndices
countNumber of partialsBuffers (input)
outSumLogLikelihoodPointer to destination for resulting sum of log likelihoods (output)
outSumFirstDerivativePointer to destination for resulting sum of first derivatives (output)
outSumSecondDerivativePointer to destination for resulting sum of second derivatives (output)
void beagle.Beagle.calculateRootLogLikelihoods ( int[]  bufferIndices,
int[]  categoryWeightsIndices,
int[]  stateFrequenciesIndices,
int[]  cumulativeScaleIndices,
int  count,
double[]  outSumLogLikelihood 
)

Calculate site log likelihoods at a root node

This function integrates a list of partials at a node with respect to a set of partials-weights and state frequencies to return the log likelihoods for each site

Parameters:
bufferIndicesList of partialsBuffer indices to integrate (input)
categoryWeightsIndicesList of indices of category weights to apply to each partialsBuffer (input) should be one categoryCount sized set for each of parentBufferIndices
stateFrequenciesIndicesList of indices of state frequencies for each partialsBuffer (input) should be one set for each of parentBufferIndices
cumulativeScaleIndicesList of scalingFactors indices to accumulate over (input). There should be one set for each of parentBufferIndices
countNumber of partialsBuffer to integrate (input)
outSumLogLikelihoodPointer to destination for resulting sum of log likelihoods (output)
void beagle.Beagle.copyScaleFactors ( int  destScalingIndex,
int  srcScalingIndex 
)

Copy scale factors

This function copies scale factors from one buffer to another.

Parameters:
instanceInstance number (input)
destScalingIndexDestination scaleBuffer (input)
srcScalingIndexSource scaleBuffer (input)

Implemented in beagle.GeneralBeagleImpl, and beagle.BeagleJNIImpl.

void beagle.Beagle.finalize ( ) throws Throwable

Finalize this instance

This function finalizes the instance by releasing allocated memory

Implemented in beagle.GeneralBeagleImpl, and beagle.BeagleJNIImpl.

InstanceDetails beagle.Beagle.getDetails ( )

Get a details class for this instance

Returns:

Implemented in beagle.GeneralBeagleImpl, and beagle.BeagleJNIImpl.

void beagle.Beagle.getPartials ( int  bufferIndex,
int  scaleIndex,
final double[]  outPartials 
)

Get partials from an instance buffer

This function copies an array of partials from an instance buffer. The inPartials array should be stateCount * patternCount * categoryCount in length.

Parameters:
bufferIndexIndex of destination partialsBuffer (input)
scaleIndexIndex of scaleBuffer to apply to partials (input)
outPartialsPointer to which to receive partialsBuffer (output)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.getSiteLogLikelihoods ( double[]  outLogLikelihoods)

Return the individual log likelihoods for each site pattern.

Parameters:
outLogLikelihoodsan array in which the likelihoods will be put
void beagle.Beagle.getTipStates ( int  tipIndex,
final int[]  outStates 
)

Get the compressed state representation for tip node

This function copies a compact state representation from an instance buffer. Compact state representation is an array of states: 0 to stateCount - 1 (missing = stateCount). The inStates array should be patternCount in length (replication across categoryCount is not required).

Parameters:
tipIndexIndex of destination partialsBuffer (input)
outStatesPointer to compressed states (input)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.getTransitionMatrix ( int  matrixIndex,
double[]  outMatrix 
)

Get a finite-time transition probability matrix

This function copies a finite-time transition matrix buffer into the array outMatrix. The outMatrix array should be of size stateCount * stateCount * categoryCount and will be filled with one matrix for each rate category.

Parameters:
matrixIndexIndex of matrix buffer (input)
outMatrixPointer to destination transition probability matrix (output)
void beagle.Beagle.removeScaleFactors ( final int[]  scaleIndices,
final int  count,
final int  cumulativeScaleIndex 
)

Remove scale factors

This function removes (log) scale factors from a cumulative scale buffer. The scale factors to be removed are indicated in a list of scaleBuffers.

Parameters:
scaleIndicesList of scaleBuffers to remove (input)
countNumber of scaleBuffers in list (input)
cumulativeScaleIndexIndex number of scaleBuffer containing accumulated factors (input)
void beagle.Beagle.resetScaleFactors ( int  cumulativeScaleIndex)

Reset scalefactors

This function resets a cumulative scale buffer.

Parameters:
cumulativeScaleIndexIndex number of cumulative scaleBuffer (input)

Implemented in beagle.GeneralBeagleImpl, and beagle.BeagleJNIImpl.

void beagle.Beagle.setCategoryRates ( final double[]  inCategoryRates)

Set category rates

This function sets the vector of category rates for an instance.

Parameters:
inCategoryRatesArray containing categoryCount rate scalers (input)
void beagle.Beagle.setCategoryWeights ( int  categoryWeightsIndex,
final double[]  categoryWeights 
)

Set a set of category weights. These will probably correspond to an eigen-system.

Parameters:
categoryWeightsIndexthe index of the buffer
categoryWeightsthe array of weights

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.setEigenDecomposition ( int  eigenIndex,
final double[]  inEigenVectors,
final double[]  inInverseEigenVectors,
final double[]  inEigenValues 
)

Set an eigen-decomposition buffer

This function copies an eigen-decomposition into a instance buffer.

Parameters:
eigenIndexIndex of eigen-decomposition buffer (input)
inEigenVectorsFlattened matrix (stateCount x stateCount) of eigen-vectors (input)
inInverseEigenVectorsFlattened matrix (stateCount x stateCount) of inverse-eigen-vectors (input)
inEigenValuesVector of eigenvalues

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.setPartials ( int  bufferIndex,
final double[]  inPartials 
)

Set an instance partials buffer

This function copies an array of partials into an instance buffer. The inPartials array should be stateCount * patternCount * categoryCount in length.

Parameters:
bufferIndexIndex of destination partialsBuffer (input)
inPartialsPointer to partials values to set (input)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.setPatternWeights ( final double[]  patternWeights)

Set the weights for each pattern

Parameters:
patternWeightsArray containing patternCount weights

Implemented in beagle.GeneralBeagleImpl, and beagle.BeagleJNIImpl.

void beagle.Beagle.setStateFrequencies ( int  stateFrequenciesIndex,
final double[]  stateFrequencies 
)

Set a set of state frequences. These will probably correspond to an eigen-system.

Parameters:
stateFrequenciesIndexthe index of the frequency buffer
stateFrequenciesthe array of frequences (stateCount)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.setTipPartials ( int  tipIndex,
final double[]  inPartials 
)

Set an instance partials buffer

This function copies an array of partials into an instance buffer. The inPartials array should be stateCount * patternCount in length. For most applications this will be used to set the partial likelihoods for the observed states. Internally, the partials will be copied categoryCount times.

Parameters:
tipIndexIndex of destination partialsBuffer (input)
inPartialsPointer to partials values to set (input)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.setTipStates ( int  tipIndex,
final int[]  inStates 
)

Set the compressed state representation for tip node

This function copies a compact state representation into an instance buffer. Compact state representation is an array of states: 0 to stateCount - 1 (missing = stateCount). The inStates array should be patternCount in length (replication across categoryCount is not required).

Parameters:
tipIndexIndex of destination partialsBuffer (input)
inStatesPointer to compressed states (input)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.setTransitionMatrix ( int  matrixIndex,
final double[]  inMatrix,
double  paddedValue 
)

This function copies a finite-time transition probability matrix into a matrix buffer. This function is used when the application wishes to explicitly set the transition probability matrix rather than using the setEigenDecomposition and updateTransitionMatrices functions. The inMatrix array should be of size stateCount * stateCount * categoryCount and will contain one matrix for each rate category.

This function copies a finite-time transition probability matrix into a matrix buffer.

Parameters:
matrixIndexIndex of matrix buffer (input)
inMatrixPointer to source transition probability matrix (input)
paddedValueValue to be used for padding for ambiguous states (e.g. 1 for probability matrices, 0 for derivative matrices) (input)
Parameters:
matrixIndexIndex of matrix buffer (input)
inMatrixPointer to source transition probability matrix (input)

Implemented in beagle.BeagleJNIImpl.

void beagle.Beagle.updatePartials ( final int[]  operations,
int  operationCount,
int  cumulativeScaleIndex 
)

Calculate or queue for calculation partials using a list of operations

This function either calculates or queues for calculation a list partials. Implementations supporting SYNCH may queue these calculations while other implementations perform these operations immediately. Implementations supporting GPU may perform all operations in the list simultaneously.

Operations list is a list of 7-tuple integer indices, with one 7-tuple per operation. Format of 7-tuple operation: {destinationPartials, destinationScaleWrite, destinationScaleRead, child1Partials, child1TransitionMatrix, child2Partials, child2TransitionMatrix}

Parameters:
operationsList of 7-tuples specifying operations (input)
operationCountNumber of operations (input)
cumulativeScaleIndexIndex number of scaleBuffer to store accumulated factors (input)
void beagle.Beagle.updateTransitionMatrices ( int  eigenIndex,
final int[]  probabilityIndices,
final int[]  firstDerivativeIndices,
final int[]  secondDervativeIndices,
final double[]  edgeLengths,
int  count 
)

Calculate a list of transition probability matrices

This function calculates a list of transition probabilities matrices and their first and second derivatives (if requested).

Parameters:
eigenIndexIndex of eigen-decomposition buffer (input)
probabilityIndicesList of indices of transition probability matrices to update (input)
firstDerivativeIndicesList of indices of first derivative matrices to update (input, NULL implies no calculation)
secondDervativeIndicesList of indices of second derivative matrices to update (input, NULL implies no calculation)
edgeLengthsList of edge lengths with which to perform calculations (input)
countLength of lists

Implemented in beagle.BeagleJNIImpl.


The documentation for this interface was generated from the following file: