Skip to content

Commit

Permalink
Avoid allocations in mapreduce with multiple arrays
Browse files Browse the repository at this point in the history
Should fix JuliaLang#53417, seeing if it passes tests.
  • Loading branch information
raminammour authored Feb 21, 2024
1 parent 65f24da commit ad7b4ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/reducedim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ julia> mapreduce(isodd, |, a, dims=1)
mapreduce(f, op, A::AbstractArrayOrBroadcasted; dims=:, init=_InitialValue()) =
_mapreduce_dim(f, op, init, A, dims)
mapreduce(f, op, A::AbstractArrayOrBroadcasted...; kw...) =
reduce(op, map(f, A...); kw...)
reduce(op, Iterators.map(f, A...); kw...)

_mapreduce_dim(f, op, nt, A::AbstractArrayOrBroadcasted, ::Colon) =
mapfoldl_impl(f, op, nt, A)
Expand Down

0 comments on commit ad7b4ad

Please sign in to comment.