-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels