Open BioTurboNick opened 1 year ago
Patch coverage: 100.00
% and project coverage change: +0.01
:tada:
Comparison is base (
ae35d10
) 94.32% compared to head (8d37a34
) 94.34%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Oops, left an nmc
off that commit. Apologies to that person.
I know I originally suggested it but it would still be nice to know why it was implemented in this way to begin with as it is quite unusual and we are really just relying on the strength of the original test set here.
My last comment is just about the convergence check. My original suggestion (https://github.com/JuliaMath/SpecialFunctions.jl/issues/442#issuecomment-1534610427) checked for relative tolerance where this just checks for absolute tolerance. It probably doesn't matter but if the final result is much smaller than 1 they could be different. (edit: relative check will be slower so not saying just to do it instead)
Alright, thanks! :-) I reverted to the original version, with your smaller suggestions. I kept the other one on another branch, gamma-fix2, just in case.
Sounds good 😊 I’ll let other people comment on what they think of the two versions.
This version will allocate though which might not solve your initial problem. If you want to sum in reverse order your probably best bet is to to use @nexprs to remove the array then can sum in any order you want. I’m not for sure it’s really needed here though but it would be nice since we are putting in the effort to make this allocation free !
Ah, found an allocation-free way! Before I commit it:
# compute first 21 terms
ts = cumprod(ntuple(i -> x / (a + i), Val(21)))
last_t = findfirst(<(1.0e-3), ts)
last_t = last_t === nothing ? 20 : last_t - 1
next_t = last_t + 1
Ah, cumprod
for tuples doesn't exist in Julia 1.3... any chance of dropping support for Julia before 1.6? (It was introduced in 1.5)
EDIT: Or can just define it here. Nevermind, too much to bring in.
Bumping - any more work needed on this?
What do I need to do to get this in? I have a couple bits of code that would really benefit from this change, and I'd like not to have to disable precompilation.
@devmotion Is this good to merge?
Many functions were translated directly from Fortran. This PR rewrites two of them using more concise Julia forms.
Ideally would like to eliminate the array allocation as well.(See #442) And now does!