-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
findextrema
: compute findmin
and findmax
in single pass
#45783
base: master
Are you sure you want to change the base?
findextrema
: compute findmin
and findmax
in single pass
#45783
Conversation
findextrema
: compute findmin
and findmax
in single pass
|
Thanks for the PR—this does seem like desirable functionality! Anyone familiar with the reduce machinery willing to code review this? |
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.
I agree with @mikmoore on the name's consistency.
As the added funtion return findmin(), findmax()
rather than extrema(), indexes
.
Although findminmax!
has been used for a internal method, we can rename it without breakage.
I went with |
Can you add something to the |
At the request of @KristofferC , the relevant news update. A separate PR is perhaps not ideal, but, given that NEWS.md moves at a different pace than JuliaLang#45783, it seemed to make sense.
6f10f26
to
2c5f7eb
Compare
This is a simple extension of extant `findmin` and `findmax` methods. Depending on context (cost of `f`; whether reduction is over dims; size of array) the speedup increase is somewhere between 1.0-1.6 (no regressions). Interestingly, I noticed but could not locate a `findextrema`; there is some [mention](JuliaLang#7327) of it, but nothing in Base. If it was deemed unworthy, please excuse this errant PR.
Embarrassingly, the original `findextrema` over all elements did not guarantee a single evaluation of `f` per iteration.
2c5f7eb
to
2190956
Compare
This is a simple extension of extant
findmin
andfindmax
methods. Depending on context (cost off
; whether reduction is over dims; size of array) the speedup increase is somewhere between 1.0-1.6 (no regressions). Interestingly, I noticed but could not locate afindextrema
; there is some mention of it, but nothing in Base. If it was deemed unworthy, please excuse this errant PR.