[Fwd: [Fwd: Re: [Numpy-discussion] Numpy and PEP 343]]

Tim Hochberg tim.hochberg at cox.net
Sat Mar 4 07:00:03 CST 2006

Check this out:

  Expression: where(0.1*a > arctan2(a, b), 2*a, arctan2(a,b))
  numpy: 0.706635284652
  Skipping weave timing
  numexpr: 0.19127785794
  Speed-up of numexpr over numpy: 3.69428689898

270% speed up! Pretty cool. Unfortunately, my implementation of two and 
three argument functions is still buggy if one of the arguments is a 
constant. I'm not sure what the best tactic is to deal with that. My 
strategy for dealing with opcodes that require more than three arguments 
(just 'where' at present) was to just use two opcode blocks. The second 
opcode block had the opcode OP_NOOP (which does nothing), but the first 
opcode steals arguments from it. It's pretty simple and more or less 
infinitely expandable.

I'm off to bed now, perhaps the answer to the constant dilemma will be 
clear in the morning.

[next morning]

OK, I know how to fix it, I just need to scrape together a few minutes to do it.


More information about the Numpy-discussion mailing list