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

Create a gufunc form of argmin and argmax #12516

eric-wieser opened this Issue Dec 9, 2018 · 1 comment


None yet
3 participants
Copy link

eric-wieser commented Dec 9, 2018

Part of #12514

In the long term, we want np.argmin to become that gufunc - but in the short term, we can just wrap it to deal with any interface quirks.

In particular, argmin allows multiple axes to be specified.

Blocked by #12518, needed to give access to ->f->compare in the inner loop


This comment has been minimized.

Copy link

mhvk commented Dec 11, 2018

In particular, argmin allows multiple axes to be specified.

Am confused: argmin only allows a single axis. Did you mean np.min? It would not seem that easy to extend the gufunc signature to include multiple axis, but perhaps one can start letting axis have a more complicated meaning. Though one would also need to think how one would return the output.

In principle, I'm not sure we really need access to the comparison function; the "default" way would be to write loops for each dtype... Plus one could let the ufunc setup function put ->f->compare into the extra data (as is currently done for many special functions). But perhaps this discussion is best done elsewhere.

Separately, I think elsewhere you suggested instead to keep track of the index in the reduction; that does seem even more complicated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment