-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
ENH: special: Add vectorized spherical Bessel functions. #5623
Conversation
Derivatives of the spherical Bessel functions are now implemented as well (and accessible using the |
Thanks for working on it @tpudlik. I looked at the tests and I think that's exactly what I wanted! |
This looks useful, but I'm not going to review the technical details. The PR has some python comments related to technical limitations regarding 'complex infinity', and I think it is handled well. I hope this can be merged soon instead of waiting indefinitely for a reviewer to dive into DLMF.
That sounds more than dramatic enough! |
(I did not review the details). I wonder if we should
|
ev-br@e305b53 tries to add a quick-and-dirty testing of |
I took a look at the boost tests---thank you for bringing them to my attention, @ev-br! I was able to get them to pass by fixing a couple bugs that reduced accuracy and raising the tolerance to I also added the tests for |
@@ master #5623 diff @@
======================================
Files 237 238 +1
Stmts 43523 43542 +19
Branches 8162 8166 +4
Methods 0 0
======================================
+ Hit 33943 33962 +19
Partial 2601 2601
Missed 6979 6979
|
Three more general comments (hope you don't mind piecewise review too much):
I'm +0 on all these points above, so that none of these is blocking. |
These functions can probably be tested against mpmath, cf. tests in |
I deprecated the The As far as testing is concerned: boost and Mathematica unfortunately do not include the modified spherical Bessel functions. But I added tests to |
Regarding the failure of complex
|
Just a quick update: I'm working on |
I've looked into the
I could add an error to |
@@ -6,6 +6,7 @@ def pre_build(context): | |||
|
|||
context.tweak_extension("orthogonal_eval", use="NPYMATH") | |||
context.tweak_extension("lambertw", use="NPYMATH") | |||
context.tweak_extension("spherical_bessel", use="NPYMATH") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not needed? The spherical functions are included in the _ufunc.so extension?
Ok, in that case probably not so much can be done in this PR to address the K issue. |
We should be all set now! (Except Travis CI doesn't seem to have started a build on my commit---is there a way to trigger it manually?) |
@tpudlik the PR needs to be rebased. I'm not sure if TravisCI tests will run then (I've never seen them not trigger at all), but otherwise maybe the simplest solution is to close this PR and open a new one with the same content. I'm not aware of a way to manually trigger. |
I think Travis won't trigger if the PR can't be merged. So a rebase should fix it. |
ENH: special: Add vectorized spherical Bessel functions.
thanks, merged |
This PR provides four new ufuncs,
spherical_jn
spherical_yn
spherical_in
spherical_kn
They are vectorized alternatives to the
specfun
wrapperssph_jn
,sph_yn
,sph_in
, andsph_kn
, providing a nicer interface, slightly higher performance and (thanks to the use of different algorithms) better stability for large real inputs. Derivatives of spherical Bessel functions, which are also computed by thespecfun
wrappers, are not yet implemented.The performance improvement is not dramatic, at a little over an order of magnitude:
Better stability, especially in
spherical_jn
andspherical_in
for large (> 10**3) real argument values, is obtained by replacing the recursivespecfun
algorithms with calls to AMOS/CEPHES cylindrical Bessel function routines, using these identities.Fixes #1641 and #2165, and (except for the still missing derivatives) implements #3113.