[Numpy-discussion] Set values of a matrix within a specified range to zero
Robert Kern
robert.kern at gmail.com
Tue Mar 30 17:40:37 EDT 2010
On Tue, Mar 30, 2010 at 16:35, Ryan May <rmay31 at gmail.com> wrote:
> On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt
> <friedrichromstedt at gmail.com> wrote:
>> x *= ((x <= 23) | (x >= 45)) .
>
> Interesting. In an ideal world, I'd love to see why exactly that is,
> because I don't think multiplication should be faster than a boolean
> op.
Branch prediction failures are really costly in modern CPUs.
http://en.wikipedia.org/wiki/Branch_prediction
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list