-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix to the CI tests I submitted #5
Conversation
…is smaller than all search library numbers, method 2 yields a 0, whereas searchsortedprevious yields a 1 (first element in the library). Likewise for the next method, if it's largest than all elements, searchsortedfirst will give a number that is one larger than the total set length(a)+1.
Codecov Report
@@ Coverage Diff @@
## main #5 +/- ##
===========================================
+ Coverage 90.90% 100.00% +9.09%
===========================================
Files 1 1
Lines 22 24 +2
===========================================
+ Hits 20 24 +4
+ Misses 2 0 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Also on a related note, there is a possible choice here on edge cases that I hadn't considered. When the search number is smaller than everything, Matlab's interp1(...,'prev') shoots out a NaN. Same when the search is larger than everything, Matlab's interp1(..., 'next') shoots out a NaN if you're number is bigger than the search set. It's sort of telling the user that "no element satisfies the requested nearest but higher or nearest but lower situation". I wonder if it would make more sense to output an empty [] in these scenarios. If the user asks for a nearest but higher number, and there is none, or the user asks for a nearest but lower number, and there is none, |
I think the |
…e search library matches the next or previous requirement.
That's reasonable. I updated the outputs to |
Cool, thanks! |
"random" but no "ground truth" tests failed on edge cases.
When the sought element is smaller than all search library numbers, method 2 yields a 0, whereas
searchsortedprevious
yields a 1 (first element in the library). Likewise, for the next method, if it's largest than all elements,searchsortedfirst
will give a number that is one larger than the total set length(a)+1.Forgot to place bounds on the second method when the test element is either larger than all elements in the search list
a
or smaller than all elementsa
.