Skip to content

Commit 21ccac6

Browse files
committed
simple sortperm
1 parent 07b50a4 commit 21ccac6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sorting.jl

+6
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,9 @@ end
543543
function Base.partialsort(c::AnyCuArray, k::Union{Integer, OrdinalRange}; kwargs...)
544544
return partialsort!(copy(c), k; kwargs...)
545545
end
546+
547+
function Base.sortperm(c::AnyCuVector; by=identity, kw...)
548+
tups = tuple.(c, eachindex(c))
549+
sort!(tups, by=byfirst, kw...)
550+
return last.(tups)
551+
end

0 commit comments

Comments
 (0)