[Numpy-discussion] Set values of a matrix within a specified range to zero
Robert Kern
robert.kern@gmail....
Tue Mar 30 16:40:37 CDT 2010
On Tue, Mar 30, 2010 at 16:35, Ryan May <rmay31@gmail.com> wrote:
> On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt
> <friedrichromstedt@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