[Numpy-discussion] Short circuiting the all() and any() methods/functions

Charles R Harris charlesr.harris@gmail....
Mon Dec 20 15:12:22 CST 2010


On Mon, Dec 20, 2010 at 1:25 PM, Justin Peel <jpscipy@gmail.com> wrote:

> It has come to my attention that the all() and any() methods/functions
> do not short circuit. It takes nearly as much time to call any() on an
> array which has 1 as the first entry as it does to call it on an array
> of the same size full of zeros.
>
> The cause of the problem is that all() and any() just call reduce()
> with the appropriate operator. Is anyone opposed to changing the
> implementations of these functions so that they short-circuit?
>
>
Recent version of reduce do short circuit. What version of numpy are you
using?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101220/a0686d63/attachment.html 


More information about the NumPy-Discussion mailing list