Functions  
void  pllEvaluateIterative (pllInstance *tr, partitionList *pr, boolean getPerSiteLikelihoods) 
Evaluate the log likelihood of a specific branch of the topology. More...  
void  pllEvaluateGeneric (pllInstance *tr, partitionList *pr, nodeptr p, boolean fullTraversal, boolean getPerSiteLikelihoods) 
Evaluate the log likelihood of the tree topology. More...  
Static functions  
static double  evaluateGAMMA_FLEX (const boolean fastScaling, int *ex1, int *ex2, int *wptr, double *x1_start, double *x2_start, double *tipVector, unsigned char *tipX1, const int n, double *diagptable, const int states, double *perSiteLikelihoods, boolean getPerSiteLikelihoods) 
A generic (and slow) implementation of log likelihood evaluation of a tree using the GAMMA model of rate heterogeneity. More...  
static double  evaluateGAMMA_FLEX_SAVE (const boolean fastScaling, int *ex1, int *ex2, int *wptr, double *x1_start, double *x2_start, double *tipVector, unsigned char *tipX1, const int n, double *diagptable, const int states, double *perSiteLikelihoods, boolean getPerSiteLikelihoods, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap) 
Memory saving version of the generic (and slow) implementation of log likelihood evaluation of a tree using the GAMMA model of rate heterogeneity. More...  
static double  evaluateCAT_FLEX (const boolean fastScaling, int *ex1, int *ex2, int *cptr, int *wptr, double *x1, double *x2, double *tipVector, unsigned char *tipX1, int n, double *diagptable_start, const int states, double *perSiteLikelihoods, boolean getPerSiteLikelihoods) 
A generic (and slow) implementation of log likelihood evaluation of a tree using the CAT model of rate heterogeneity. More...  
static double  evaluateCAT_FLEX_SAVE (const boolean fastScaling, int *ex1, int *ex2, int *cptr, int *wptr, double *x1, double *x2, double *tipVector, unsigned char *tipX1, int n, double *diagptable_start, const int states, double *perSiteLikelihoods, boolean getPerSiteLikelihoods, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap) 
A generic (and slow) implementation of log likelihood evaluation of a tree using the CAT model of rate heterogeneity with memory saving. More...  
static double  evaluateGTRGAMMAPROT_LG4 (int *ex1, int *ex2, int *wptr, double *x1, double *x2, double *tipVector[4], unsigned char *tipX1, int n, double *diagptable, const boolean fastScaling) 
Evaluation of log likelihood of a tree under the GAMMA model of rate heterogeneity and LG4 model of evolution. More...  
static double  evaluateGTRGAMMAPROT_GAPPED_SAVE (const boolean fastScaling, int *ex1, int *ex2, int *wptr, double *x1, double *x2, double *tipVector, unsigned char *tipX1, int n, double *diagptable, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap) 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity and the memory saving technique (Optimized SSE3 version for AA data) More...  
static double  evaluateGTRGAMMAPROT (const boolean fastScaling, int *ex1, int *ex2, int *wptr, double *x1, double *x2, double *tipVector, unsigned char *tipX1, int n, double *diagptable) 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity (Optimized SSE3 version for AA data) More...  
static double  evaluateGTRCATPROT (const boolean fastScaling, int *ex1, int *ex2, int *cptr, int *wptr, double *x1, double *x2, double *tipVector, unsigned char *tipX1, int n, double *diagptable_start) 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity (Optimized SSE3 version for AA data) More...  
static double  evaluateGTRCATPROT_SAVE (const boolean fastScaling, int *ex1, int *ex2, int *cptr, int *wptr, double *x1, double *x2, double *tipVector, unsigned char *tipX1, int n, double *diagptable_start, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap) 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity with memory saving (Optimized SSE3 version for AA data) More...  
static double  evaluateGTRCAT_SAVE (const boolean fastScaling, int *ex1, int *ex2, int *cptr, int *wptr, double *x1_start, double *x2_start, double *tipVector, unsigned char *tipX1, int n, double *diagptable_start, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap) 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity with memory saving (Optimized SSE3 version for DNA data) More...  
static double  evaluateGTRGAMMA_GAPPED_SAVE (const boolean fastScaling, int *ex1, int *ex2, int *wptr, double *x1_start, double *x2_start, double *tipVector, unsigned char *tipX1, const int n, double *diagptable, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap) 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity with memory saving (Optimized SSE3 version for DNA data) More...  
static double  evaluateGTRGAMMA (const boolean fastScaling, int *ex1, int *ex2, int *wptr, double *x1_start, double *x2_start, double *tipVector, unsigned char *tipX1, const int n, double *diagptable) 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity (Optimized SSE3 version for DNA data) More...  
static double  evaluateGTRCAT (const boolean fastScaling, int *ex1, int *ex2, int *cptr, int *wptr, double *x1_start, double *x2_start, double *tipVector, unsigned char *tipX1, int n, double *diagptable_start) 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity (Optimized SSE3 version for DNA data) More...  
This set of functions deals with the evaluation of likelihood for the current topology

static 
A generic (and slow) implementation of log likelihood evaluation of a tree using the CAT model of rate heterogeneity.
Computes the log likelihood of the topology for a specific partition, assuming that the CAT model of rate heterogeneity is used. The likelihood is computed at a virtual root placed at an edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Furthermore, if getPerSiteLikelihoods is set to PLL_TRUE, then the log likelihood for each site is also computed and stored at the corresponding position in the array perSiteLikelihoods.
fastScaling  If set to PLL_FALSE, then the likelihood of each site is also multiplied by log(PLL_MINLIKELIHOOD) times the number of times it has been scaled down 
ex1  An array that holds how many times a site has been scaled and points at the entries for node p. This parameter is used if fastScaling is set to PLL_FALSE. 
ex2  An array that holds how many times a site has been scaled and points at the entries for node q. This parameter is used if fastScaling is set to PLL_TRUE. 
cptr  Array holding the rate for each site in the compressed partition alignment 
wptr  Array holding the weight for each site in the compressed partition alignment 
x1  Conditional likelihood vectors for one of the two endpoints of the specific edge for which we are evaluating the likelihood 
x2  Conditional likelihood vectors for the other endpoint of the specific edge for which we are evaluating the likelihood 
tipVector  Precomputed table where the number of rows is equal to the number of possible basepair characters for the current data type, i.e.16 for DNA and 23 for AA, and each rows contains states elements each of which contains transition probabilities computed from the eigenvectors of the decomposed Q matrix. 
tipX1  If one of the two endpoints (nodes) of the specific edge (for which we are evaluating the likelihood) is a tip, then this holds a pointer to the sequence data (basepairs) already converted in the internal integer representation, and x2 holds the conditional likelihood vectors for the internal node. 
n  Number of sites for which we are doing the evaluation. For the singlethread version this is the number of sites in the current partition, for multithreads this is the number of sites assigned to the running thread from the current partition. 
diagptable_start  Start of the array that contains the PMatrix diagonal of the specific edge for which we are evaluating the likehood, and for each category of the CAT model 
states  Number of states (4 for DNA, 20 for AA) 
perSiteLikelihoods  Array to store persite log likelihoods if getPerSiteLikelihoods is set to PLL_TRUE 
getPerSiteLikelihoods  If set to PLL_TRUE then persite log likelihoods are also computed and stored in perSiteLikelihoods 

static 
A generic (and slow) implementation of log likelihood evaluation of a tree using the CAT model of rate heterogeneity with memory saving.
This is the same as evaluateCAT_FLEX but with the memory saving technique enabled. Please check evaluateCAT_FLEX for more information and a description of the common input parameters
x1_gapColumn  
x2_gapColumn  
x1_gap  Gap bitvector for the left child node 
x2_gap  Gap bitvector for the right child node 

static 
A generic (and slow) implementation of log likelihood evaluation of a tree using the GAMMA model of rate heterogeneity.
Computes the log likelihood of the topology for a specific partition, assuming that the GAMMA model of rate heterogeneity is used. The likelihood is computed at a virtual root placed at an edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Furthermore, if getPerSiteLikelihoods is set to PLL_TRUE, then the log likelihood for each site is also computed and stored at the corresponding position in the array perSiteLikelihoods.
fastScaling  If set to PLL_FALSE, then the likelihood of each site is also multiplied by log(PLL_MINLIKELIHOOD) times the number of times it has been scaled down 
ex1  An array that holds how many times a site has been scaled and points at the entries for node p. This parameter is used if fastScaling is set to PLL_FALSE. 
ex2  An array that holds how many times a site has been scaled and points at the entries for node q. This parameter is used if fastScaling is set to PLL_TRUE. 
wptr  Array holding the weight for each site in the compressed partition alignment 
x1_start  Conditional likelihood vectors for one of the two endpoints of the specific edge for which we are evaluating the likelihood 
x2_start  Conditional likelihood vectors for the other endpoint of the specific edge for which we are evaluating the likelihood 
tipVector  Precomputed table where the number of rows is equal to the number of possible basepair characters for the current data type, i.e.16 for DNA and 23 for AA, and each rows contains states elements each of which contains transition probabilities computed from the eigenvectors of the decomposed Q matrix. 
tipX1  If one of the two endpoints (nodes) of the specific edge (for which we are evaluating the likelihood) is a tip, then this holds a pointer to the sequence data (basepairs) already converted in the internal integer representation, and x2 holds the conditional likelihood vectors for the internal node. 
n  Number of sites for which we are doing the evaluation. For the singlethread version this is the number of sites in the current partition, for multithreads this is the number of sites assigned to the running thread from the current partition. 
diagptable  Start of the array that contains the PMatrix diagonal of the specific edge for which we are evaluating the likehood, and for each category of the GAMMA model 
states  Number of states (4 for DNA, 20 for AA) 
perSiteLikelihoods  Array to store persite log likelihoods if getPerSiteLikelihoods is set to PLL_TRUE 
getPerSiteLikelihoods  If set to PLL_TRUE then persite log likelihoods are also computed and stored in perSiteLikelihoods 

static 
Memory saving version of the generic (and slow) implementation of log likelihood evaluation of a tree using the GAMMA model of rate heterogeneity.
Computes the log likelihood of the topology for a specific partition, assuming that the GAMMA model of rate heterogeneity is used and memory saving technique is enabled. The likelihood is computed at a virtual root placed at an edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Furthermore, if getPerSiteLikelihoods is set to PLL_TRUE, then the log likelihood for each site is also computed and stored at the corresponding position in the array perSiteLikelihoods.
fastScaling  If set to PLL_FALSE, then the likelihood of each site is also multiplied by log(PLL_MINLIKELIHOOD) times the number of times it has been scaled down 
ex1  An array that holds how many times a site has been scaled and points at the entries for node p. This parameter is used if fastScaling is set to PLL_FALSE. 
ex2  An array that holds how many times a site has been scaled and points at the entries for node q. This parameter is used if fastScaling is set to PLL_TRUE. 
wptr  Array holding the weight for each site in the compressed partition alignment 
x1_start  Conditional likelihood vectors for one of the two endpoints of the specific edge for which we are evaluating the likelihood 
x2_start  Conditional likelihood vectors for the other endpoint of the specific edge for which we are evaluating the likelihood 
tipVector  Precomputed table where the number of rows is equal to the number of possible basepair characters for the current data type, i.e.16 for DNA and 23 for AA, and each rows contains states elements each of which contains transition probabilities computed from the eigenvectors of the decomposed Q matrix. 
tipX1  If one of the two endpoints (nodes) of the specific edge (for which we are evaluating the likelihood) is a tip, then this holds a pointer to the sequence data (basepairs) already converted in the internal integer representation, and x2 holds the conditional likelihood vectors for the internal node. 
n  Number of sites for which we are doing the evaluation. For the singlethread version this is the number of sites in the current partition, for multithreads this is the number of sites assigned to the running thread from the current partition. 
diagptable  Start of the array that contains the PMatrix diagonal of the specific edge for which we are evaluating the likehood, and for each category of the GAMMA model 
states  Number of states (4 for DNA, 20 for AA) 
perSiteLikelihoods  Array to store persite log likelihoods if getPerSiteLikelihoods is set to PLL_TRUE 
getPerSiteLikelihoods  If set to PLL_TRUE then persite log likelihoods are also computed and stored in perSiteLikelihoods 
x1_gapColumn  
x2_gapColumn  
x1_gap  Gap bitvector for the left child node 
x2_gap  Gap bitvector for the right child node 

static 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity (Optimized SSE3 version for DNA data)
This is the SSE3 optimized version of evaluateCAT_FLEX for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateCAT_FLEX for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity with memory saving (Optimized SSE3 version for DNA data)
This is the SSE3 optimized version of evaluateCAT_FLEX_SAVE for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateCAT_FLEX_SAVE for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity (Optimized SSE3 version for AA data)
This is the SSE3 optimized version of evaluateCAT_FLEX for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateCAT_FLEX for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the CAT model of rate heterogeneity with memory saving (Optimized SSE3 version for AA data)
This is the SSE3 optimized version of evaluateCAT_FLEX_SAVE for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateCAT_FLEX_SAVE for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity (Optimized SSE3 version for DNA data)
This is the SSE3 optimized version of evaluateGAMMA_FLEX for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateGAMMA_FLEX for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity with memory saving (Optimized SSE3 version for DNA data)
This is the SSE3 optimized version of evaluateGAMMA_FLEX_SAVE for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateGAMMA_FLEX_SAVE for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity (Optimized SSE3 version for AA data)
This is the SSE3 optimized version of evaluateGAMMA_FLEX for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateGAMMA_FLEX for more information and a description of the common input parameters

static 
Evaluation of log likelihood of a tree using the GAMMA model of rate heterogeneity and the memory saving technique (Optimized SSE3 version for AA data)
This is the SSE3 optimized version of evaluateGAMMA_FLEX_SAVE for evaluating the log likelihood at some edge whose two endpoints (nodes) have the conditional likelihood vectors x1 and x2. Please check evaluateGAMMA_FLEX_SAVE for more information and a description of the input parameters

static 
Evaluation of log likelihood of a tree under the GAMMA model of rate heterogeneity and LG4 model of evolution.
This is the same as evaluateGAMMA_FLEX but for the LG4 model. It contains two implementations, one which is the generic, and one that is optimized with SSE3 instructions. The two implementations are separated by preprocessor macros. The difference from evaluateGAMMA_FLEX is that we have 4 different tipVectors computed from the 4 different Q matrix decompositions. Please check evaluateGAMMA_FLEX for more information and a description of the common input parameters.
void pllEvaluateGeneric  (  pllInstance *  tr, 
partitionList *  pr,  
nodeptr  p,  
boolean  fullTraversal,  
boolean  getPerSiteLikelihoods  
) 
Evaluate the log likelihood of the tree topology.
Evaluate the log likelihood of the tree topology of instance tr by assuming a virtual root between nodes p and p>back. If fullTraversal is set to PLL_TRUE then the log likelihood vectors for each node are recomputed from scratch.
tr  PLL instance 
pr  List of partitions 
p  Specifies the virtual root, which is assumed to be a (virtual node) connecting p and p>back 
fullTraversal  If set to PLL_TRUE, then the likelihood vectors at all nodes are recomputed, otherwise only the necessary vectors (those that are not oriented in the right direction) are recomputed. 
getPerSiteLikelihoods  Also compute and store (in tr>lhs) the log likelihood of each site of the (compressed) alignment 
void pllEvaluateIterative  (  pllInstance *  tr, 
partitionList *  pr,  
boolean  getPerSiteLikelihoods  
) 
Evaluate the log likelihood of a specific branch of the topology.
Evaluates the likelihood of the tree topology assuming a virtual root is placed at the edge whose endpoints are node with number pNumber and qNumber in the first slot of the traversal descriptor. The function first computes the conditional likelihoods for all necessary nodes (the ones in the traversal descriptor list) by calling the function pllNewviewIterative and then evaluates the likelihood at the root. In addition, if getPerSiteLikelihoods is set to PLL_TRUE, the persite likelihoods are stored in tr>lhs.
tr  PLL instance 
pr  List of partitions 
getPerSiteLikelihoods  If set to PLL_TRUE, compute the log likelihood for each site. 