Package pal.substmodel
Class CachedRateMatrix
java.lang.Object
pal.substmodel.CachedRateMatrix
- All Implemented Interfaces:
Serializable,Cloneable,NamedParameterized,PalObjectListener,Parameterized,Report,RateMatrix
a cached rate matrix.
This model caches transition probabilities by distance in order
to increase speed of likelihood calculations for repeated calls with same/similar
branch lengths.
AS OF 11 November 2003 this class has been made abstract and will be removed at a later point (as it never really helped much)
AS OF 11 November 2003 this class has been made abstract and will be removed at a later point (as it never really helped much)
- Version:
- $Id: CachedRateMatrix.java,v 1.13 2003/11/13 04:05:39 matt Exp $
- Author:
- Alexei Drummond
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface pal.misc.PalObjectListener
PalObjectListener.EventGeneratorNested classes/interfaces inherited from interface pal.misc.Parameterized
Parameterized.Null, Parameterized.ParameterizedBase, Parameterized.ParameterizedUser, Parameterized.Utils -
Constructor Summary
ConstructorsConstructorDescriptionCachedRateMatrix(CachedRateMatrix cachedRateMatrix) CachedRateMatrix(RateMatrix rateMatrix, int maxCacheSize) CachedRateMatrix(RateMatrix rateMatrix, DoubleKeyCache cache) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a PalObjectListener to be notified of changes to the model.final Objectclone()A non shallow implementation of clone()final DataTypeGet the data type of this rate matrixfinal doublegetDefaultValue(int n) get default value of parameterfinal intfinal double[]final doublegetEquilibriumFrequency(int i) final doublegetLowerLimit(int n) get lower parameter limitfinal intget numerical code describing the model typefinal intget number of parametersfinal doublegetParameter(int n) get model parameterfinal StringgetParameterName(int i) final double[][]final voidgetTransitionProbabilities(double[][] probs) A utility method for speed, transfers trans prob information quickly into storefinal doublegetTransitionProbability(int i, int j) get transition probability for the preselected model and the previously specified distancefinal intget numerical code describing the data typefinal Stringfinal doublegetUpperLimit(int n) get upper parameter limitvoidSignifies that parametric valued governing the state of this Object have changed.voidfinal voidreport(PrintWriter out) print human readable report (e.g., on parameters and associated model)final voidsetDistance(double k) set distance and corresponding computation transition probabilitiesfinal voidsetDistanceTranspose(double k) Sets the distance (such as time/branch length) used when calculating the probabilities.final voidsetParameter(double param, int n) set model parameterfinal voidsetParameterSE(double paramSE, int n) set standard errors for model parametervoidSignifies that the structure of the object has changed (for example in trees to topology has changed)toString()Return string representation of substitution model.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface pal.substmodel.RateMatrix
scale, setParametersNoScale
-
Constructor Details
-
CachedRateMatrix
- Parameters:
model- the underlying substitution modelcache- the caching method used
-
CachedRateMatrix
- Parameters:
model- the underlying substitution model
-
CachedRateMatrix
- Parameters:
model- the previous cached model.
-
-
Method Details
-
report
Description copied from interface:Reportprint human readable report (e.g., on parameters and associated model) -
getTypeID
public final int getTypeID()Description copied from interface:RateMatrixget numerical code describing the data type- Specified by:
getTypeIDin interfaceRateMatrix- Returns:
- integer code identifying a data type
-
getModelID
public final int getModelID()Description copied from interface:RateMatrixget numerical code describing the model type- Specified by:
getModelIDin interfaceRateMatrix- Returns:
- integer code identifying a substitution model
-
getDimension
public final int getDimension()- Specified by:
getDimensionin interfaceRateMatrix- Returns:
- the dimension of this rate matrix.
-
getEquilibriumFrequencies
public final double[] getEquilibriumFrequencies()- Specified by:
getEquilibriumFrequenciesin interfaceRateMatrix- Returns:
- stationary frequencies (sum = 1.0)
-
getEquilibriumFrequency
public final double getEquilibriumFrequency(int i) - Specified by:
getEquilibriumFrequencyin interfaceRateMatrix- Returns:
- stationary frequency (sum = 1.0) for ith state Preferred method for infrequent use.
-
getRelativeRates
public final double[][] getRelativeRates()- Specified by:
getRelativeRatesin interfaceRateMatrix- Returns:
- rate matrix (transition: from 1st index to 2nd index)
-
toString
Return string representation of substitution model. -
getNumParameters
public final int getNumParameters()Description copied from interface:Parameterizedget number of parameters- Specified by:
getNumParametersin interfaceParameterized- Returns:
- number of parameters
-
setParameter
public final void setParameter(double param, int n) Description copied from interface:Parameterizedset model parameter- Specified by:
setParameterin interfaceParameterized- Parameters:
param- parameter valuen- parameter number
-
getParameter
public final double getParameter(int n) Description copied from interface:Parameterizedget model parameter- Specified by:
getParameterin interfaceParameterized- Parameters:
n- parameter number- Returns:
- parameter value
-
setParameterSE
public final void setParameterSE(double paramSE, int n) Description copied from interface:Parameterizedset standard errors for model parameter- Specified by:
setParameterSEin interfaceParameterized- Parameters:
paramSE- standard error of parameter valuen- parameter number
-
getLowerLimit
public final double getLowerLimit(int n) Description copied from interface:Parameterizedget lower parameter limit- Specified by:
getLowerLimitin interfaceParameterized- Parameters:
n- parameter number- Returns:
- lower bound
-
getUpperLimit
public final double getUpperLimit(int n) Description copied from interface:Parameterizedget upper parameter limit- Specified by:
getUpperLimitin interfaceParameterized- Parameters:
n- parameter number- Returns:
- upper bound
-
getDefaultValue
public final double getDefaultValue(int n) Description copied from interface:Parameterizedget default value of parameter- Specified by:
getDefaultValuein interfaceParameterized- Parameters:
n- parameter number- Returns:
- default value
-
getParameterName
- Specified by:
getParameterNamein interfaceNamedParameterized- Returns:
- a short identifier for this parameter type. Should be the same for all instances of a given class!
-
setDistance
public final void setDistance(double k) set distance and corresponding computation transition probabilities- Specified by:
setDistancein interfaceRateMatrix- Parameters:
k- distance
-
setDistanceTranspose
public final void setDistanceTranspose(double k) Description copied from interface:RateMatrixSets the distance (such as time/branch length) used when calculating the probabilities.- Specified by:
setDistanceTransposein interfaceRateMatrix
-
getTransitionProbability
public final double getTransitionProbability(int i, int j) get transition probability for the preselected model and the previously specified distance- Specified by:
getTransitionProbabilityin interfaceRateMatrix- Parameters:
i- start statej- end state- Returns:
- transition probability
-
getTransitionProbabilities
public final void getTransitionProbabilities(double[][] probs) Description copied from interface:RateMatrixA utility method for speed, transfers trans prob information quickly into store- Specified by:
getTransitionProbabilitiesin interfaceRateMatrix
-
clone
A non shallow implementation of clone()- Specified by:
clonein interfaceRateMatrix- Overrides:
clonein classObject
-
getDataType
Description copied from interface:RateMatrixGet the data type of this rate matrix- Specified by:
getDataTypein interfaceRateMatrix
-
getUniqueName
- Specified by:
getUniqueNamein interfaceRateMatrix- Returns:
- a short unique human-readable identifier for this rate matrix.
-
structureChanged
Description copied from interface:PalObjectListenerSignifies that the structure of the object has changed (for example in trees to topology has changed)- Specified by:
structureChangedin interfacePalObjectListener
-
parametersChanged
Description copied from interface:PalObjectListenerSignifies 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:
parametersChangedin interfacePalObjectListener
-
addPalObjectListener
Description copied from interface:RateMatrixAdd a PalObjectListener to be notified of changes to the model. Only the parametersChanged method will generally be called- Specified by:
addPalObjectListenerin interfaceRateMatrix
-
removePalObjectListener
- Specified by:
removePalObjectListenerin interfaceRateMatrix
-
getOrthogonalHints
- Specified by:
getOrthogonalHintsin interfaceRateMatrix- Returns:
- null
-