pal.eval
Class GeneralLikelihoodCalculator

java.lang.Object
  extended by pal.eval.GeneralLikelihoodCalculator
All Implemented Interfaces:
LikelihoodCalculator, PalObjectListener

public class GeneralLikelihoodCalculator
extends java.lang.Object
implements PalObjectListener, LikelihoodCalculator

Title: General Likelihood Calculator
Description: A General likelihood calculator
This calculates the likelihood of an topologically invariant tree (on an unchanging alignment) quickly by remembering partial likelihoods of invariant subtrees, and by essentially generating site patterns for each sub tree. Works with Rate Distributions and other more complex SubstitutionModels. Will optimise (as in computational time) itself when using Nucleotide based data.

Version:
$Id: GeneralLikelihoodCalculator.java,v 1.10 2004/01/12 09:30:27 matt Exp $
Author:
Matthew Goode

Nested Class Summary
 
Nested classes/interfaces inherited from interface pal.misc.PalObjectListener
PalObjectListener.EventGenerator
 
Constructor Summary
GeneralLikelihoodCalculator(Alignment baseAlignment, Tree tree, RateMatrix model)
          Constructor taking site pattern, tree and a rate matrix.
GeneralLikelihoodCalculator(Alignment baseAlignment, Tree tree, RateMatrix model, RateDistribution distribution)
          Constructor taking site pattern, tree rate matrix, and a rate distribution
GeneralLikelihoodCalculator(Alignment baseAlignment, Tree tree, SubstitutionModel model)
          Constructor taking site pattern, tree and a general substitution model.
 
Method Summary
 double calculateLogLikelihood()
           
 LikelihoodSummary calculateLogLikelihoodSummary()
           
protected static void directProduct4(double[] v1, double[] v2, double[] store)
           
protected static double dotProduct4(double[] v1, double[] v2)
           
protected static double dotProduct4(double[] v1, double[] v2, double[] v3)
           
 void parametersChanged(PalObjectEvent pe)
          Signifies that parametric valued governing the state of this Object have changed.
 void release()
          This method should be called when the user is through using this calculator to inform it to release any resources it has allocated.
 void setup(Tree t, SubstitutionModel model)
           
 void structureChanged(PalObjectEvent pe)
          Signifies that the structure of the object has changed (for example in trees to topology has changed)
protected static double sum4(double[] v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralLikelihoodCalculator

public GeneralLikelihoodCalculator(Alignment baseAlignment,
                                   Tree tree,
                                   RateMatrix model)
Constructor taking site pattern, tree and a rate matrix.


GeneralLikelihoodCalculator

public GeneralLikelihoodCalculator(Alignment baseAlignment,
                                   Tree tree,
                                   RateMatrix model,
                                   RateDistribution distribution)
Constructor taking site pattern, tree rate matrix, and a rate distribution


GeneralLikelihoodCalculator

public GeneralLikelihoodCalculator(Alignment baseAlignment,
                                   Tree tree,
                                   SubstitutionModel model)
Constructor taking site pattern, tree and a general substitution model.

Method Detail

parametersChanged

public void parametersChanged(PalObjectEvent pe)
Description copied from interface: PalObjectListener
Signifies that parametric valued governing the state of this Object have changed. Parameters don't have to be visible ones For example, in trees the branch lengths have changed.

Specified by:
parametersChanged in interface PalObjectListener

structureChanged

public void structureChanged(PalObjectEvent pe)
Description copied from interface: PalObjectListener
Signifies that the structure of the object has changed (for example in trees to topology has changed)

Specified by:
structureChanged in interface PalObjectListener

setup

public final void setup(Tree t,
                        SubstitutionModel model)

release

public void release()
Description copied from interface: LikelihoodCalculator
This method should be called when the user is through using this calculator to inform it to release any resources it has allocated.

Specified by:
release in interface LikelihoodCalculator

calculateLogLikelihood

public double calculateLogLikelihood()
Specified by:
calculateLogLikelihood in interface LikelihoodCalculator
Returns:
the likelihood of this tree under the given model and data.

calculateLogLikelihoodSummary

public LikelihoodSummary calculateLogLikelihoodSummary()
Returns:
the LikelihoodSummary of this tree under the given model and data.

dotProduct4

protected static final double dotProduct4(double[] v1,
                                          double[] v2)

dotProduct4

protected static final double dotProduct4(double[] v1,
                                          double[] v2,
                                          double[] v3)

directProduct4

protected static final void directProduct4(double[] v1,
                                           double[] v2,
                                           double[] store)

sum4

protected static final double sum4(double[] v)