You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement total_branch_length using numpy ops? #1794
I'm sure this'll be faster most of the time, but I guess there could be some cases where overhead of creating the time array leads to a regression. There'll be a bit of memory overhead too, but I doubt this is significant.
Any thoughts on whether we should/shouldn't do things like this?
(In retrospect this should have been a function rather than a property, as it would have been more useful (you could specify the root node you wanted to sum from), and it also violates the "properties are inexpensive" rule. I think my reasoning at the time was that this was something we should be able to keep track of efficiently incrementally, but this isn't actually true under the current definition, which only sums branch length reachable from roots. That ship has sailed anyway, but I guess we should make a note of this in the comments if/when we're updating the method)
Although, on second thoughts, we can trivially implement this now in C using the preorder function and there's no downside there, so it would be quicker to just do this than to try to benchmark the pros and cons of the numpy version.
This could be a good example to use for illustrating tree operations using numpy, though (#1788)
Activity
jeromekelleher commentedon Oct 13, 2021
Although, on second thoughts, we can trivially implement this now in C using the
preorderfunction and there's no downside there, so it would be quicker to just do this than to try to benchmark the pros and cons of the numpy version.This could be a good example to use for illustrating tree operations using numpy, though (#1788)
Implement total_branch_length in C
Implement total_branch_length in C
Implement total_branch_length in C
Implement total_branch_length in C