Skip to content

Commit 977fe4d

Browse files
LilithHafnerLilith Hafnerpiever
authored
Switch from permute!! to permute! (#272)
* Switch from `permute!!` to `permute!` * Remove unused specialization of `permute!!` * support component-array permute! specializations and tweak refarray use * remove invalid `refarray` call Co-authored-by: Pietro Vertechi <[email protected]> --------- Co-authored-by: Lilith Hafner <[email protected]> Co-authored-by: Pietro Vertechi <[email protected]>
1 parent 0a5eb81 commit 977fe4d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: src/sort.jl

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using Base.Sort, Base.Order
22

3-
function Base.permute!!(c::StructArray, p::AbstractVector{<:Integer})
4-
Base.invoke(Base.permute!!, Tuple{AbstractArray, AbstractVector{<:Integer}}, refarray(c), p)
5-
return c
6-
end
3+
Base.permute!(sa::StructArray, p::AbstractVector) = foreachfield(v -> permute!(v, p), sa)
74

85
struct GroupPerm{V<:AbstractVector, P<:AbstractVector{<:Integer}, U<:AbstractUnitRange}
96
vec::V
@@ -65,7 +62,7 @@ function Base.sortperm(c::StructVector{T}) where {T<:Union{Tuple, NamedTuple}}
6562
return p
6663
end
6764

68-
Base.sort!(c::StructArray{<:Union{Tuple, NamedTuple}}) = (Base.permute!!(c, sortperm(c)); c)
65+
Base.sort!(c::StructArray{<:Union{Tuple, NamedTuple}}) = (permute!(c, sortperm(c)); c)
6966
Base.sort(c::StructArray{<:Union{Tuple, NamedTuple}}) = c[sortperm(c)]
7067

7168
# Given an ordering `p`, return a vector `v` such that `Perm(Forward, v)` is

0 commit comments

Comments
 (0)