[SciPy-User] scipy.weave.blitz bug using functions

Felix Schlesinger schlesin@cshl....
Sun Oct 18 20:23:45 CDT 2009


Hi,

is this a bug or am I doing something wrong?

import scipy
arr = scipy.random.rand(1000000)
res = scipy.zeros_like(arr)
blitz("""res = sin(2*sin(arr+1))""")

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/weave/blitz_tools.pyc
in blitz(expr, local_dict, global_dict, check_size, verbose, **kw)
     32     #    of time.  It also can cause core-dumps if the sizes
of the inputs
     33     #    aren't compatible.
---> 34     if check_size and not
size_check.check_expr(expr,local_dict,global_dict):
     35         raise 'inputs failed to pass size check.'
     36

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/weave/size_check.pyc
in check_expr(expr, local_vars, global_vars)
     49         if isnumeric(val):
     50             values[var] = val
---> 51     exec(expr,values)
     52     try:
     53         exec(expr,values)

NameError: name 'sin' is not defined
---------------------------------------------------------------------------------------------------------

If I do
blitz("""res = sin(2*sin(arr+1))""", check_size=0)
it works. Seems to me the check_size code tries to check the size of
the array 'sin', instead of recognizing it as a function.

Felix


More information about the SciPy-User mailing list