Repository navigation
Commit cc75ed2
Vectorize StateDistributionCR.logpdf against scipy.special
logpdf() runs once per state on every E step over the whole lineage
array, but still went through the frozen rv_continuous machinery
(self.div_clock.logpdf/logsf, self.death_clock.logpdf/logsf) for that -
the same class of overhead already fixed in division_probability(),
just not applied here. Replaced with direct vectorized formulas against
scipy.special (gammaln/gammaincc), matching the old output to float
precision (verified numerically) while cutting test_works_through_crossval
from ~14.7s to ~6.3s in isolation.
The div_clock/death_clock properties are left in place since
compare_emissions.py still uses them outside this hot path.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent fe21e41 commit cc75ed2
1 file changed
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
242 | 252 | | |
243 | 253 | | |
244 | 254 | | |
245 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
246 | 262 | | |
247 | 263 | | |
248 | 264 | | |
249 | 265 | | |
250 | | - | |
| 266 | + | |
| 267 | + | |
251 | 268 | | |
252 | 269 | | |
253 | 270 | | |
254 | 271 | | |
255 | | - | |
256 | | - | |
257 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
258 | 275 | | |
259 | 276 | | |
260 | 277 | | |
| |||
0 commit comments