[Numpy-discussion] Numexpr does broadcasting.

Stefan van der Walt stefan at sun.ac.za
Sun Jun 18 20:14:44 CDT 2006


Hi Tim

On Wed, Jun 21, 2006 at 12:02:27PM -0700, Tim Hochberg wrote:
> 
> Numexpr can now handle broadcasting. As an example, check out this 
> implementation of the distance-in-a-bunch-of-dimenstions function that's 
> been going around. This is 80% faster than the most recent one posted on 
> my box and considerably easier to read.

This looks really cool.  However, it does seem to break scalar
operation:

a = 3.
b = 4.
expr = numexpr("2*a+3*b",[('a',float),('b'.float)])
expr.run(a,b)

Out[41]: array(-7.1680117685147315e-39)

I havn't used numexpr before, so I could be doing something silly
(although I did verify that the above works on r1986).

Cheers
Stéfan




More information about the Numpy-discussion mailing list