JuliaMath / Bessels.jl

Bessel functions for real arguments and orders
https://juliamath.github.io/Bessels.jl/
MIT License
78 stars 11 forks source link

Invalid stop condition in besseli_power_series #115

Open genmeblog opened 4 months ago

genmeblog commented 4 months ago

Hi,

I believe that arguments in this condition:

https://github.com/JuliaMath/Bessels.jl/blob/fa3a1cb3376fb47177c8e09252d0e73385762478/src/BesselFunctions/besseli.jl#L626

should be reversed, ie Math.check_convergence(s, t) && break

Currently the loop spins 3k times causing slow evaluation.

heltonmc commented 4 months ago

Thanks for this bug report. This looks like an oversight with the AD translation to Enzyme compatibility. I'll tag @cgeoga to make sure this hasn't percolated through other code bases as well. Need to check all the series that use this function