-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add specialised Bessel functions from SLATEC #53
Comments
For the use cases of I do not know how these methods compare to the SLATEC version, though. This leaves |
I would have generally expected libm to be more robust than slatec. But I have no direct experience with these. |
I did a quick check against netlib/specfun equivalents of
|
@stevengj Would it be useful to pull in the double precision variants? If so, I don't mind putting it together. |
Would the right way here be to package SLATEC up in BinaryBuilder and make it available for use in SpecialFunctions.jl? |
SLATEC has > 1400 functions. Do we want them all? A lot of this seems useless. |
I tried to pull just the Bessel functions, but there were dependencies all over the place. I suppose I can find a set that works. |
Maybe a better choice is "switch to Bessels.jl for real bessel functions" (JuliaMath/SpecialFunctions.jl#409) Benchmarkjulia v1.6Bessels.jl is 200~300 times faster than SpecialFunctions.jl. julia> # besselk0
julia> @btime SpecialFunctions.besselk(0, 0.5)
181.277 ns (1 allocation: 16 bytes)
0.9244190712276656
julia> @btime Bessels.besselk0(0.5)
0.700 ns (0 allocations: 0 bytes)
0.9244190712276659
julia> # besselk0x
julia> @btime SpecialFunctions.besselkx(0, 0.5)
261.032 ns (1 allocation: 16 bytes)
1.5241093857739092
julia> @btime Bessels.besselk0x(0.5)
0.700 ns (0 allocations: 0 bytes)
1.5241093857739096
julia> # besselk1
julia> @btime SpecialFunctions.besselk(1, 0.5)
189.198 ns (1 allocation: 16 bytes)
1.6564411200033007
julia> @btime Bessels.besselk1(0.5)
0.700 ns (0 allocations: 0 bytes)
1.656441120003301
julia> # besselk1x
julia> @btime SpecialFunctions.besselkx(1, 0.5)
270.820 ns (1 allocation: 16 bytes)
2.7310097082117855
julia> @btime Bessels.besselk1x(0.5)
0.900 ns (0 allocations: 0 bytes)
2.731009708211786 |
Should we close this and note so in the README? @oscardssmith? |
Yeah. These benchmarks are wrong (the functions are getting constant folded), but the idea is correct.
|
Currently openspecfun only includes the
Z
- versions provided by SLATEC which expect a double precision complex number as input.However there are also
D
- versions specialised for double precision reals, and further specialised -0
and -1
versions hereof. Given Julia's multiple dispatch SpecialFunctions.jl could automatically select the fastest option, if these became available here. Is this feasible?The text was updated successfully, but these errors were encountered: