[Numpy-discussion] fast_any_all , a trivial but fast/useful helper function for numpy

Robert Kern robert.kern at gmail.com
Wed Sep 4 12:28:15 EDT 2013


On Wed, Sep 4, 2013 at 1:14 PM, Graeme B. Bell <grb at skogoglandskap.no>
wrote:
>
> Sorry, I should have been more clear.
>
> As shown in the benchmark/example, the method is replacing the behaviour
of
>
>    np.any(inputs, 0)
>
> not the behaviour of
>
>    np.any(inputs)

reduce(np.logical_or, inputs, False)
reduce(np.logical_and, inputs, True)

Your fast_logic() is basically reduce().

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130904/0dd5efe7/attachment.html>


More information about the NumPy-Discussion mailing list