-
Notifications
You must be signed in to change notification settings - Fork 46
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 specifications for sorting functions #19
Conversation
Thanks @kgryte. Can you also list the ones you considered and left out here? E.g.
I'd say we want the same order for all libraries by default, so should be specified.
Hmm good question. It makes sense as a convenience; the alternative is to add Given that it's trivial to do
Not sure - from first principles specifying a stable sort as the default may make sense, but then it will require a |
Re: other APIs. Updated the OP. Re: sort order. Updated the proposal to sort in ascending order (by default). Re: And agreed. I also prefer a boolean keyword argument (e.g., Re: stability. My guess is that array libraries may want the flexibility to choose their default implementation. We could go a middle path and follow Tensorflow Maybe one additional forward looking concern is, should we spec |
That's a good reason indeed, +1 for adding a keyword.
I'd be inclined to not worry about that - complex sorting may need specific keywords and hence another function. The "sort by real values first" in |
Re: |
@kgryte this was discussed in the 27 Aug meeting; the minutes still need to be updated from the video, and then this PR needs an update I think (or a confirmation that we agreed on |
@kgryte ping on this last point on |
@rgommers Updated the PR to include a |
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.
LGTM now, thanks @kgryte
This PR
'descending'
). This follows Torch and TensorFlow.argsort
where a stable sort permutation may be desired.Notes
lexsort
,partition
,argpartition
,msort
); however, these functions are not widely implemented by other analyzed array libraries (less than half; see here) and, thus, were not included in this initial specification. Should additional sorting functions be necessary, they can be proposed in follow-up proposals.