Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdebartha committed Aug 28, 2023
1 parent b8be0a5 commit 7653f2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/weights.jl
Original file line number Diff line number Diff line change
Expand Up @@ -698,13 +698,13 @@ w = rand(n)
mean(√, x, weights(w))
```
"""
mean(f, A::AbstractArray, w::AbstractWeights; kwargs...) =
mean(collect(Iterators.map(f, A)), w; kwargs...)
mean(f, A, w::AbstractWeights; kwargs...) =
mean(broadcast(f, A), w; kwargs...)

function mean(f, A::AbstractArray, w::UnitWeights; dims::Union{Colon,Int}=:)
a = (dims === :) ? length(A) : size(A, dims)
a != length(w) && throw(DimensionMismatch("Inconsistent array dimension."))
return mean(collect(Iterators.map(f, A)), dims=dims)
return mean(broadcast(f, A), dims=dims)
end

##### Weighted quantile #####
Expand Down

0 comments on commit 7653f2c

Please sign in to comment.