Skip to content

Commit

Permalink
make cumprod and cumsum work left to right. fixes #3574
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 28, 2013
1 parent f26c710 commit b3555da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ for (f, op) = ((:cumsum, :+), (:cumprod, :*) )

c[1] = v[1]
for i=2:n
c[i] = ($op)(v[i], c[i-1])
c[i] = ($op)(c[i-1], v[i])
end
return c
end
Expand All @@ -931,7 +931,7 @@ for (f, op) = ((:cumsum, :+), (:cumprod, :*) )
if div(i-1, axis_stride) % axis_size == 0
B[i] = A[i]
else
B[i] = ($op)(A[i], B[i-axis_stride])
B[i] = ($op)(B[i-axis_stride], A[i])
end
end

Expand Down

0 comments on commit b3555da

Please sign in to comment.