-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add findmin, findmax, argmin, and argmax #53
base: master
Are you sure you want to change the base?
Conversation
@mlubin can you review this when you get the chance? |
Codecov Report
@@ Coverage Diff @@
## master #53 +/- ##
==========================================
+ Coverage 94.89% 95.68% +0.79%
==========================================
Files 1 1
Lines 98 116 +18
==========================================
+ Hits 93 111 +18
Misses 5 5
Continue to review full report at Codecov.
|
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.
Thanks for the contribution. I could accept this after some reworking.
Please rebase on top of #54. I saw the 1.0 build is failing, so I dropped support for 1.0. |
@mlubin thanks for the review! I have addressed all of your suggestions. Because this PR adds new functions to the API, I incremented the minor version, as specified by the Pkg.jl docs. |
It looks like tests are failing on 1.6. |
Should be fixed now. A few tests were testing against Base methods not introduced until Julia 1.7 or hitting Base bugs on 1.6 fixed on 1.7. |
@mlubin would you like to you re-review? |
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.
Thanks for the reminder. The new version looks good. I have a minor comment on the tests. Please also update the README to mention the new functions.
Done! |
Hmm, there's a test failure on 1.6 (x86). |
Codecov Report
@@ Coverage Diff @@
## master #53 +/- ##
=========================================
Coverage ? 95.08%
=========================================
Files ? 1
Lines ? 122
Branches ? 0
=========================================
Hits ? 116
Misses ? 6
Partials ? 0 Continue to review full report at Codecov.
|
The failure on x86 but not x64 is likely due to a different coincidental ordering of julia> NaNMath.argmin(Dict(:x => 3, :w => NaN, :z => -1.0, :y => NaN))
:w
julia> NaNMath.argmax(Dict(:x => 3, :w => NaN, :z => -1.0, :y => NaN))
:w |
This PR adds versions of
findmin
,findmax
,argmin
andargmax
that ignoreNaN
s in the codomain. It does not include methods that take adims
keyword.Fixes #31
A simple benchmark: