[Numpy-discussion] subtract.reduce behavior

John Salvatier jsalvati@u.washington....
Thu Jul 22 15:09:32 CDT 2010


I get the same result on 1.4.1

On Thu, Jul 22, 2010 at 1:00 PM, Johann Hibschman <
jhibschman+numpy@gmail.com <jhibschman%2Bnumpy@gmail.com>> wrote:

> 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
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100722/0584f37f/attachment.html 


More information about the NumPy-Discussion mailing list