I managed to get basic support for sum and prod into numpexpr. I need to
tie up some loose ends, for instance only floats are currently
supported, but these should be easy. To return to the recently posted
multidimensional distance program, this now works:
expr = numexpr("sum((a - b)**2, axis=2)", [('a', float), ('b', float)])
def dist_numexpr(A, B):
return sqrt(expr(A[:,newaxis], B[newaxis,:]))
It's also quite fast, although there's still room for improvement in the
reduction code. Notice that it still needs to be in two parts since
sum/prod needs to surround the rest of the expression. Note also that it
does support the axis keyword, although currently only nonnegative
values (or None). I plan to fix that at some point though.
-tim
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/numpy-discussion