[Numpy-discussion] numexpr thoughts
by Tim Hochberg other posts by this author
Mar 5 2006 4:53PM messages near this date
[Numpy-discussion] Tests fail in svn r2195
|
Re: [Numpy-discussion] numexpr thoughts
1. David already mentioned opcodes to copy from an integer array into a
float register. Another idea would be to have an opcode to copy from a
strided array into a register. This would save a copy for noncontiguous
matrices and opens up the door to doing broadcasting. I think we'd have
to tweak the main interpreter loop a bit, but I think it's doable.
Depending how crunched we feel for opcode space, the casting array and
this array could overlap (OP_CAST_AND_COPY for instance).
2. Something I noticed while writing tests is that the rearangement of
operations for 'a/const' to '(1/const)*a' changes the results slightly
(try const=3). I don't think I care -- I just thought I'd point it out.
3. It may simplify things to use copy_c to eliminate a bunch of the
extra bytecodes for operating on functions of more than one argument. I
need to check the timings on this -- I don't know how much of a speed
hit using copy_c will cause.
4. At some point I plan to add complex operations. My original thought
was to just duplicate the current, floating-point interpreter for
complex numbers. However, if we have opcodes for casting, it might
instead make sense to have one interpreter that works with both. This
would be more efficient for mixed expressions since we wouldnt' have to
case everything complex right away. It looks like there's enough opcode
space, although I worry a bit whether making that main switch loop huge
is going to slow things down. Probably not, but it's something to keep
an eye on.
5. Same thoughts as 4., but for integer operations. Potentially the
interpreter could work with longs, doubles and cdoubles, downcasting as
appropriate on the way out.
It's looking like numexpr could come pretty close to evaluating most
numpy expressions if we put enough work into it. None of the required
changes look like they should slow down the original, simple, fast case.
However we should keep an eye on that as we go along. It's all very
cool; I'd like to thank David for providing such a fun toy.
-tim
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Thread:
Tim Hochberg
David M. Cooke
Tim Hochberg
Tim Hochberg
David M. Cooke
Tim Hochberg
Tim Hochberg
Tim Hochberg
David M. Cooke
Robert Kern
David M. Cooke
|