Skip to content

Commit

Permalink
Update reducedim.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
N5N3 committed Dec 31, 2021
1 parent ffed6b8 commit 00202f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions base/reducedim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ function _mapreducedim!(f, op, R::AbstractArray, A::AbstractArrayOrBroadcasted)
i1 = first(axes1(R))
@inbounds for IA in CartesianIndices(indsAt)
IR = Broadcast.newindex(IA, keep, Idefault)
r = R[i1,IR]
@simd for i in axes(A, 1)
r = op(r, f(A[i, IA]))
end
R[i1,IR] = r
@inline elf(i) = @inbounds f(A[i, IA])
ax1 = axes(A, 1)
# use mapreduce_impl for performance
r = mapreduce_impl(elf, op, ax1, firstindex(ax1), lastindex(ax1))
R[i1,IR] = op(R[i1,IR], r)
end
else
@inbounds for IA in CartesianIndices(indsAt)
Expand Down

0 comments on commit 00202f7

Please sign in to comment.