shunwang / numexpr

Automatically exported from code.google.com/p/numexpr
MIT License
0 stars 0 forks source link

AttributeError: 'OpNode' object has no attribute 'sum' #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The README for numexpr 2.0.1 states that it supports numpy sum operation.  But 
that didn't work for me.

To reproduce the bug use the attached python script with numpy 1.6.1 and either 
numexpr 2.0.1 or the current hg version.  The tests were done on Ubuntu 12.04 
with the system Python 2.7 and numpy 1.6.1.  And the numexpr source was 
downloaded and built, with a symbolic link to the numexpr package put in the 
directory with the test program.

The expected output is:

    zone1 10
    zone2 10

Instead the script generates a backtrace when using numexpr version:

    AttributeError: 'OpNode' object has no attribute 'sum'

Original issue reported on code.google.com by gregco...@gmail.com on 30 May 2012 at 5:52

Attachments:

GoogleCodeExporter commented 9 years ago
sum is indeed supported, but as a function, not as a method:

numexpr.evaluate("sum((centers - zone_center) ** 2, axis=1)")

Original comment by gdemen...@gmail.com on 8 Feb 2013 at 1:21