pal.eval
Class FastLikelihoodCalculator

java.lang.Object
  |
  +--pal.eval.FastLikelihoodCalculator
All Implemented Interfaces:
LikelihoodCalculator, PalObjectListener

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

Title: Fast Likelihood Calculator
Description: A fast likelihood calculator
Original code by Matthew Goode. This calculates the likelihood of similar trees (or a single changing tree) on the same site pattern fast by remembering partial likelihoods of invariant subtrees.


Constructor Summary
FastLikelihoodCalculator(SitePattern pattern)
          Constructor taking only site pattern.
FastLikelihoodCalculator(SitePattern pattern, Tree tree, RateMatrix model)
          Constructor taking site pattern, tree and model.
 
Method Summary
 double calculateLogLikelihood()
           
 void parametersChanged(PalObjectEvent pe)
          Signifies that parametric valued governing the state of this Object have changed.
 void setRateMatrix(RateMatrix rateMatrix)
           
 void setTree(Tree t)
           
 void structureChanged(PalObjectEvent pe)
          Signifies that the structure of the object has changed (for example in trees to topology has changed)
 void updateSitePattern(SitePattern pattern)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastLikelihoodCalculator

public FastLikelihoodCalculator(SitePattern pattern)
Constructor taking only site pattern.
NOTE: setTree and setRateMatrix must both be called (in that order) before computeLikelihood.

FastLikelihoodCalculator

public FastLikelihoodCalculator(SitePattern pattern,
                                Tree tree,
                                RateMatrix model)
Constructor taking site pattern, tree and 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

setRateMatrix

public final void setRateMatrix(RateMatrix rateMatrix)

setTree

public final void setTree(Tree t)

updateSitePattern

public final void updateSitePattern(SitePattern pattern)

calculateLogLikelihood

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