Skip to content
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

RadixSort broken for By and Perm orders #48

Closed
LilithHafner opened this issue Aug 5, 2021 · 0 comments · Fixed by #63
Closed

RadixSort broken for By and Perm orders #48

LilithHafner opened this issue Aug 5, 2021 · 0 comments · Fixed by #63

Comments

@LilithHafner
Copy link
Member

Sorting with a Perm ordering fails to implement Julia's fallback to compare indices when data are equal (doc, code). Sorting with a By ordering assumes o.order == Forward.

using SortingAlgorithms
using Random: shuffle!
using Base.Order: Perm, By, Forward, Reverse
data = rand(1:10, 10)
inds = shuffle!(collect(1:10))
perm = Perm(Forward, data)
issorted(sort(inds, order=perm), order=perm) # true
issorted(sort(inds, alg=RadixSort, order=perm), order=perm) # false
by = By((-), Reverse)
issorted(sort(inds, order=by), order=by) # true
issorted(sort(inds, alg=RadixSort, order=by), order=by) # false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant