Skip to content

Commit

Permalink
Fix UnitWeights slow iteration (JuliaLang#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieugomez authored Sep 29, 2020
1 parent ec33334 commit fbf9e66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/weights.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ All weight elements are identically one.
sum(wv::UnitWeights{T}) where T = convert(T, length(wv))
isempty(wv::UnitWeights) = iszero(wv.len)
length(wv::UnitWeights) = wv.len
size(wv::UnitWeights) = Tuple(length(wv))
size(wv::UnitWeights) = tuple(length(wv))

Base.convert(::Type{Vector}, wv::UnitWeights{T}) where {T} = ones(T, length(wv))

Expand Down

0 comments on commit fbf9e66

Please sign in to comment.