John Salvatier wrote:
> I get the same result on 1.4.1
>
> On Thu, Jul 22, 2010 at 1:00 PM, Johann Hibschman 
> <jhibschman+nu...@gmail.com <mailto:jhibschman%2bnu...@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?
>

numpy.divide.reduce has the same "problem".  If the docstring
is correct, then numpy.divide.reduce([2.0, 2.0]) should be
0.25, but

In [13]: np.divide.reduce([2.0, 2.0])
Out[13]: 1.0

Instead of

    <identity> op <val0> op <val1> op ...

it appears to compute

    <val0> op <val1> op ...


Warren

>     Thanks,
>     Johann
>
>     _______________________________________________
>     NumPy-Discussion mailing list
>     NumPy-Discussion@scipy.org <mailto:NumPy-Discussion@scipy.org>
>     http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>   

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to