Skip to content

Commit 1277ff9

Browse files
committed
Cleanup weighted sum (no longer imported from Base)
1 parent e9728b2 commit 1277ff9

File tree

3 files changed

+233
-262
lines changed

3 files changed

+233
-262
lines changed

src/Statistics.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function _mean!(R::AbstractArray, A::AbstractArray, weights::Nothing)
151151
end
152152

153153
_mean!(R::AbstractArray, A::AbstractArray, w::AbstractArray) =
154-
rmul!(_sum!(R, A, weights=w), inv(sum(w)))
154+
rmul!(wsum!(R, A, weights=w), inv(sum(w)))
155155

156156
"""
157157
mean(A::AbstractArray; [dims], [weights::AbstractArray])
@@ -223,7 +223,7 @@ end
223223

224224
# Note: weighted mean currently does not use _mean_promote to avoid overflow
225225
_mean(::typeof(identity), A::AbstractArray, dims::Colon, w::AbstractArray) =
226-
_sum(A, weights=w) / sum(w)
226+
wsum(A, weights=w) / sum(w)
227227

228228
_mean(::typeof(identity), A::AbstractArray, dims, w::AbstractArray) =
229229
_mean!(Base.reducedim_init(t -> (t*zero(eltype(w)))/2, Base.add_sum, A, dims), A, w)

0 commit comments

Comments
 (0)