xflouris / libpll

Phylogenetic Likelihood Library
GNU Affero General Public License v3.0
26 stars 6 forks source link

Add PATTERN_TIP-compliant core functions #60

Closed pierrebarbera closed 8 years ago

pierrebarbera commented 8 years ago

The core functions need to be updated to include the tip-tip and tip-inner optimizations, i.e. computation of conditional likelihoods based on char* instead of double*.

xflouris commented 8 years ago

Currently we only have PLL_EXPORT void pll_core_update_partial, which assumes tips also have full CLVs. Therefore it is always an inner-inner operation. Moreover, it is only in non-vectorized form.

I'm documenting here the way to implement this, but it will require some careful thinking:

libpll is a generic library that supports arbitrary number of states. Sequences (characters) are translated using a pre-specified map (e.g., pll_map_nt) to state bit-masks, that is, numbers that set the used states. To have a generic library (in terms of number of states) for the tip-tip case, these translated sequences are then again re-mapped into a new set of states which are numbered from 0 to (at most) 255, i.e., the maximum number of different (including ambiguous) STATES defined by the ASCII characters. This remapping is necessary for pre-computing a lookup table of state-pairs since, for example, AA data can have very large numbers as bit-masks due to the 20 states. The lookup table is of size at most 256x256, and it is an array indexed such that the 2 x ceil(log(STATES)) MSB bits indicate the state-pair and the rest are for state x rates conditionals.

Points for this task:

pierrebarbera commented 8 years ago

Small update on this: I don't need it for epa anymore as I found a way to use the standard functions for my "ranged" use case, however I think it would still be good to consolidate all the functions into the "core".

xflouris commented 8 years ago

finished.