Pull Request Overview
- Opened on October 21, 2026
- Status Merged
- Commit count 1 with first commit October 22, 2026
Total Delta
Open Days
Test Delta
How long has this pull request spent in each phase of its lifecycle?
Data pending calculation for pull request
Reduce redundant digamma and lgamma evaluations in special functions.
Reduce redundant digamma and lgamma evaluations in special functions.
igamma_grad_a_impl and random_gamma_grad_impl evaluated both digamma(a) and digamma(a + 1) across unconditionally evaluated select branches even though each element only uses one branch after the loop finishes. Select a or a + 1 up front and pass the shared log(x) - digamma(...) term into both helpers, cutting digamma calls from two to one in each function.
In _hyp2f1_digamma_transform, AMS55 15.3.10β15.3.12 only apply when d = c - a - b is within 50 * eps of an integer rd, while a 0..|rd| loop already runs to accumulate log(|rd|!). Accumulate the harmonic sum 1 / (e - t) inside that loop with a first-order trigamma correction for e - |rd|, replacing digamma(1 + e) and cutting digamma calls from three to two. Also hoist the duplicate lax.lgamma(new_a) call in betaln.
PR was closed without comments.