ENH: add changes from Amos (1995) to amos.h#149
Open
JaRoSchm wants to merge 1 commit into
Open
Conversation
Contributor
Author
Contributor
Author
|
Maybe, we should use the new implementation for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue
Closes #137
What does this implement/fix?
This adds the improvements from Amos' 1995 paper to the Amos library. The original Fortran code, which I translated by hand, is available here (functional changes are limited to
besy, the old version has been renamed tobesyhequivalent to the Fortran code). I became aware of this as I stumbled across this repo, which compares the accuracy of the original Fortran code, scipy, and a rust translation. The deviations for the scaled functionyveare fixed by this PR (I suspect the remaining ones to appear due to translation errors from the original translation). Here I reproduced their plot with this PR (the version of scipy in the legend is wrong):Locally, the
xsreftests foryvandjv(which usesyvhere) fail on this PR. I think this can be fixed by slightly increasing the respective relative tolerances. I computed the percentiles for the test cases fromxsrefforyv,yve,jv, andjvefor real and complex inputs to show that there are no significant negative impacts of this PR. However, there are not many positive changes either as the regions of improved accuracy seem to not be included inxsref:yv dd->d (7780 inputs)
Number of increased relative errors: 1107
Number of decreased relative errors: 505
yv dD->D (17158 inputs)
Number of increased relative errors: 5154
Number of decreased relative errors: 2549
yve dd->d (20 inputs)
Number of increased relative errors: 4
Number of decreased relative errors: 1
yve dD->D (66 inputs)
Number of increased relative errors: 13
Number of decreased relative errors: 44
jv dd->d (3416 inputs)
Number of increased relative errors: 56
Number of decreased relative errors: 57
jv dD->D (3374 inputs)
Number of increased relative errors: 215
Number of decreased relative errors: 69
jve dd->d (21 inputs)
Number of increased relative errors: 0
Number of decreased relative errors: 0
jve dD->D (66 inputs)
Number of increased relative errors: 0
Number of decreased relative errors: 0
Inputs significantly improved by this PR:
$\nu$ = 100: z = +-100 +- 0.001/0.1/1/5/10/30/50i, z = +- 200/300 +- 0.001/0.1/1/5/10/30/50/100i, ...
$\nu$ = 500, z = +-1000 +- 0.001/0.1/1/5/10/30/50/100/200/500i, ...
Additional information
None
AI Generation Disclosure
No AI tools used