Add special::i0: Modified Bessel i0 for real arguments as crate internal#71
Closed
SpookyYomo wants to merge 6 commits intoqsib-cbie:mainfrom
Closed
Add special::i0: Modified Bessel i0 for real arguments as crate internal#71SpookyYomo wants to merge 6 commits intoqsib-cbie:mainfrom
SpookyYomo wants to merge 6 commits intoqsib-cbie:mainfrom
Conversation
Bessel i0 function written with reference to Numerical Recipes in C++, currently only with f64. Authored-by: ArtemiszenN <artemiszenn@gmail.com> Signed-off-by: SpookyYomo <48710653+SpookyYomo@users.noreply.github.com>
Currently code is not ready for generic float, and requires more work.
Contributor
Author
|
The clippy warning about float precision (especially for the f32 const array) makes it hard to keep track of the original const array used if we had to round it all off. Perhaps we allow clippy to ignore these warnings specific to this case? |
Contributor
Author
|
Since I wrote up the example Maturin bindings for #70 , I went ahead and tried up the i0_doub code here. Plotting code is as exposed in SpookyYomo@2b6129d. |
We also add unsafe bounds since the function is currently only intended to be crate-internal.
This will allow for f32 implementation for generics later.
This is very hacky and just copies all the const arrays from f64 to f32. Also not as accurate for very large arguments such as x>~20 being passed to i0. (Correspondingly similar unit test for ~30 is not being tested in f32).
Unit test caught this issue
Contributor
Author
|
Superceded by #73, as this PR used a function that was implemented differently form scipy. |
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.


With reference to discussion #53 (comment), only f32 and f64 implemented. Until we make the code more robust, I propose that it be kept crate internal only for firwin-related functions, until more concrete decisions around numeric types we wish to support and others are made.