Skip to content
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

Consider replacing SpecialFunctions.jl by pure Julia alternatives #94

Open
juliohm opened this issue Sep 14, 2022 · 2 comments
Open

Consider replacing SpecialFunctions.jl by pure Julia alternatives #94

juliohm opened this issue Sep 14, 2022 · 2 comments

Comments

@juliohm
Copy link

juliohm commented Sep 14, 2022

I've noticed that DualNumbers.jl checks if the function is available in SpecialFunctions.jl to wrap the definition with the Dual type. More recently, initiatives such as Bessels.jl have gained traction. They are pure Julia implementations of special functions that are faster and differentiable. What are your thoughts on replacing SpecialFunctions.jl by Bessels.jl and similar efforts to clean up the dependency tree downstream?

DualNumbers.jl is an indirect dependency of Distributions.jl which is pretty much everywhere in the ecosystem. So installing Distributions.jl nowadays comes with the downside of installing external _jll libraries and a ton of dependencies that could be avoided with Bessels.jl and friends.

I've already migrated all my packages from SpecialFunctions.jl to Bessels.jl because they provide all the bessel functions and the gamma (non-exported) functions I need without a single dependency.

cc: @heltonmc @cgeoga @oscardssmith

@dlfivefifty
Copy link
Collaborator

Looks as though Bessels.jl has a long way to go before its a full replacement: e.g. complex numbers

I'm surprised it's restricted to specific floating point types (Float32, Float64, etc.), eg, why not support BigFloat? I realise this is much more complicated but I think if one is going through all the effort its worth going that extra mile

@heltonmc
Copy link

I'll have to admit I'm not very familiar with this package or its downstream dependents and it is true that you can't propagate Dual numbers. That wasn't really a priority as taking derivatives are best handled by identities (unless wrt to order e.g., BesselK.jl).

If support for Complex numbers is really what's holding back adoption then I can focus on that. I wouldn't say it has a long way necessarily because all the algorithms can be used for complex numbers I just haven't really tested where best to make those branches. Though, the Amos routines that SpecialFunctions.jl use just develop routines for the modified bessel functions and use identities to piece together all the other functions. That is definitely the simplest but far from optimal.

Higher precision is definitely on the radar and we already have cutoffs for most regions. Though, I will say I don't really have intention to support BigFloat precision maybe like Float128 or Double64 at most. The algorithms even for Double64 and Float64 are pretty different.... so it takes some time to have these different implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants