Skip to content

Commit 2108ae0

Browse files
committed
some cleanups
1 parent e812e7d commit 2108ae0

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/InMemoryDatasets.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ export
8585
# from stat
8686
stdze,
8787
rescale,
88-
wsum,
89-
wmean,
9088
topk,
9189
cummax,
9290
cummax!,

src/stat/non_hp_stat.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ stat_mean(x::AbstractArray{T,1}) where T = stat_mean(identity, x)
197197

198198
function stat_wmean(f, x::AbstractVector{T}, w::AbstractArray{S,1}) where T where S
199199
all(ismissing, x) && return missing
200-
_dmiss(y)::T = ismissing(y[1])||ismissing(y[2]) ? zero(T) : (f(y[1])*y[2])::T
201-
_dmiss2(y)::S = ismissing(y[1])||ismissing(y[2]) ? zero(S) : y[2]
202-
_op(y1,y2)::Tuple{T,S} = _stat_add_sum.(y1, y2)
203-
_f(y)::Tuple{T,S} = (_dmiss(y), _dmiss2(y))
204-
sval, n = mapreduce(_f, _op, zip(x,w))::Tuple{T,S}
200+
_dmiss(y) = ismissing(y[1])||ismissing(y[2]) ? zero(T) : (f(y[1])*y[2])
201+
_dmiss2(y) = ismissing(y[1])||ismissing(y[2]) ? zero(S) : y[2]
202+
_op(y1,y2) = _stat_add_sum.(y1, y2)
203+
_f(y) = (_dmiss(y), _dmiss2(y))
204+
sval, n = mapreduce(_f, _op, zip(x,w))
205205
n == 0 ? missing : sval / n
206206
end
207207
stat_wmean(x::AbstractVector{T}, w::AbstractArray{S,1}) where T where S = stat_wmean(identity, x, w)

0 commit comments

Comments
 (0)