[Numpy-discussion] subtract.reduce behavior
Johann Hibschman
jhibschman+numpy@gmail....
Thu Jul 22 15:00:50 CDT 2010
I'm trying to understand numpy.subtract.reduce. The documentation
doesn't seem to match the behavior. The documentation claims
For a one-dimensional array, reduce produces results equivalent to:
r = op.identity
for i in xrange(len(A)):
r = op(r,A[i])
return r
However, numpy.subtract.reduce([1,2,3]) gives me 1-2-3==-4, not
0-1-2-3==-6.
Now, I'm on an older version (1.3.0), which might be the problem, but
which is "correct" here, the code or the docs?
Thanks,
Johann
More information about the NumPy-Discussion
mailing list