[Numpy-discussion] Numexpr does broadcasting. (original) (raw)

Stefan van der Walt stefan at sun.ac.za
Sun Jun 18 21:14:44 EDT 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("2a+3b",[('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