Comments (2)
The actual source code is in https://github.com/JuliaLang/openspecfun ... the functions indeed have the option of returning a sequence of Bessel functions (see the N argument of zbesj, for example. It seems like it would be straightforward to add support for this for the case where the nu argument is a range with step(nu) == 1
.
from specialfunctions.jl.
This change can be implemented by, for example, changing the following lines in bessel.jl
:
ccall((:zbesh_,openspecfun), Cvoid,
(Ref{Float64}, Ref{Float64}, Ref{Float64}, Ref{Int32}, Ref{Int32}, Ref{Int},
Ref{Float64}, Ref{Float64}, Ref{Int32}, Ref{Int32}),
real(z), imag(z), nu, kode, k, 1,
ai1, ai2, ae1, ae2)
to
ccall((:zbesh_,openspecfun), Cvoid,
(Ref{Float64}, Ref{Float64}, Ref{Float64}, Ref{Int32}, Ref{Int32}, Ref{Int},
Ptr{Float64}, Ptr{Float64}, Ref{Int32}, Ref{Int32}),
real(z), imag(z), nu, kode, k, N,
ai1, ai2, ae1, ae2)
where ai1,ai2
are arrays instead of references. Limited testing shows a drastic cut in time and allocated memory:
julia> @btime besselh.(0:5, 1, 1.1+0.1im)
5.658 μs (61 allocations: 1.11 KiB)
6-element Array{Complex{Float64},1}:
0.651368+0.11899im
0.393305-0.665955im
-0.0513027-1.38437im
-1.03222-4.31003im
-7.65254-21.4245im
-68.2153-145.21im
julia> @btime besselhseq(0, 5, 1, 1.1+0.1im)
1.460 μs (11 allocations: 560 bytes)
6-element Array{Complex{Float64},1}:
0.651368+0.11899im
0.393305-0.665955im
-0.0513027-1.38437im
-1.03222-4.31003im
-7.65254-21.4245im
-68.2153-145.21im
However, I'm unsure what would be the best way to wrap these functions. If using the existing signatures, one would have to handle the case where some Bessel orders are negative, since zbesh
only works for nu >= 0
.
from specialfunctions.jl.
Related Issues (20)
- SpecialFunctions do not compile on an Apple M2 (but on an Apple M1)? HOT 2
- TagBot trigger issue HOT 4
- Derivative of the generalised zeta function
- Add logabsgamma(::Complex) HOT 3
- incorrect reference HOT 2
- Address known-broken ChainRules tests
- Add gamma(::Complex{BigFloat}) HOT 1
- Inverse of erfi
- Reduce/remove inner allocations (e.g. `gamma_inc_taylor`, `gamma_inc_asym`) HOT 9
- Segfault in besselj HOT 2
- Regularized Kumer Functions? HOT 1
- Generalize beta, logbeta, etc. to any number of arguments
- Accuracy of `digamma` function can be improved HOT 1
- What about `gamma_inc_inv`'s derivative ? HOT 2
- `expint(nu,z)` has bad precision for `nu != 1`
- Failing to build on Apple M1 Sonoma HOT 1
- Registering Functions with `Symbolics.jl` HOT 1
- Large negative real number arguments return NaN for expintx HOT 1
- Rewrite all AMOS code in julia HOT 5
- Internals of the incomplete gamma function does not work with `ForwardDiff.jl`'s `Dual()` type due to enforced floating point precision HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specialfunctions.jl.