liamrevell / phytools

GNU General Public License v3.0
207 stars 56 forks source link

improve fastBM #1

Open KlausVigo opened 8 years ago

KlausVigo commented 8 years ago

Hi Liam,

my first pull request. I changed in the function fastBM only the call of simOU to use a vectorized version of nsim as for simBM. In simBM I reorder the tree in "cladewise" order. Than the tree traversal is simply going through the edge matrix. Results are identical for nsim=1, but differ for nsim>1. The same simplification is done inside simOU. For large trees with 1000 taxa 3-4 times faster and much faster for huge trees (10000 taxa) can much faster (100x). But also the code is much cleaner.

Cheers, Klaus