You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/stat/hp_stat.jl
+87Lines changed: 87 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,46 @@ Base.@propagate_inbounds function hp_topk_vals(x::AbstractVector{T}, k::Int, lt_
87
87
end
88
88
topk_vals(res_out, k, lt_fun, by)
89
89
end
90
+
Base.@propagate_inboundsfunctionhp_topk_vals(x::Union{Vector{T}, SubArray{T, N, Vector{T}, Tuple{I}, L}}, k::Int, lt_fun::F, by) where {T<:Union{Missing, FLOATS, INTEGERS}} where {F} where N where I <:UnitRange{Int}where L
91
+
k <1&&throw(ArgumentError("k must be greater than 1"))
Base.@propagate_inboundsfunctionhp_topk_perm(x::AbstractVector{T}, k::Int, lt_fun::F, by) where {T} where {F}
92
132
k <1&&throw(ArgumentError("k must be greater than 1"))
@@ -124,4 +164,51 @@ Base.@propagate_inbounds function hp_topk_perm(x::AbstractVector{T}, k::Int, lt_
124
164
end
125
165
end
126
166
perm_out[topk_perm(res_out, k, lt_fun, by)]
167
+
end
168
+
169
+
Base.@propagate_inboundsfunctionhp_topk_perm(x::Union{Vector{T}, SubArray{T, N, Vector{T}, Tuple{I}, L}}, k::Int, lt_fun::F, by) where {T<:Union{Missing, FLOATS, INTEGERS}} where {F} where N where I <:UnitRange{Int}where L
170
+
k <1&&throw(ArgumentError("k must be greater than 1"))
@@ -484,6 +510,35 @@ Base.@propagate_inbounds function topk_vals(x::AbstractVector{T}, k::Int, lt_fun
484
510
end
485
511
end
486
512
513
+
#if k is greater than 20 (15 in topkperm) we switch to binary search - 21 and 16 are selected based on simulation study
514
+
Base.@propagate_inboundsfunctiontopk_vals(x::Union{Vector{T}, SubArray{T, N, Vector{T}, Tuple{I}, L}}, k::Int, lt_fun::F, by) where {T<:Union{Missing, FLOATS, INTEGERS}} where {F} where N where I <:UnitRange{Int}where L
515
+
k <1&&throw(ArgumentError("k must be greater than 1"))
#TODO should we return [missing] or Int[] when all elements are missings?
489
544
Base.@propagate_inboundsfunctiontopk_perm(x::AbstractVector{T}, k::Int, lt_fun::F, by) where {T} where {F}
@@ -505,6 +560,34 @@ Base.@propagate_inbounds function topk_perm(x::AbstractVector{T}, k::Int, lt_fun
505
560
allowmissing(perm)
506
561
end
507
562
end
563
+
Base.@propagate_inboundsfunctiontopk_perm(x::Union{Vector{T}, SubArray{T, N, Vector{T}, Tuple{I}, L}}, k::Int, lt_fun::F, by) where {T<:Union{Missing, FLOATS, INTEGERS}} where {F} where N where I <:UnitRange{Int}where L
564
+
k <1&&throw(ArgumentError("k must be greater than 1"))
0 commit comments