-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I think this project is really cool! I have an application where I need to perform partial sorting (per here and here) and was trying to adapt your code to handle this case. Would you have any suggestions on where to start? I naively tried to modify ssortperm!! to accept lo and hi based on the desired partial sort indices, e.g.,
function partialssortperm!!(ix::AbstractVector{Int}, v::AbstractVector, idxrange::UnitRange{Int}; lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
axes(ix) == axes(v) || throw(ArgumentError("index array must have the same size/axes as the source array, $(axes(ix)) != $(axes(v))"))
ix .= LinearIndices(v)
vs = StructArray{Tuple{eltype(v),eltype(ix)}}(val=v, ix=ix)
o = ord(lt, by, rev ? true : nothing, order)
lo = idxrange[1] # <- new
hi = idxrange[end] # <- new
_sortperm_inplace_small_optimization!(ix, v, vs, lo, hi, o::Ordering)
ix
end
but I failed to get a correct implementation.
Do you think there's an easy fix? Or do you think it involve digging into the internals of _sortperm_inplace_small_optimization!?
Thanks!
Jake
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels