shunwang / numexpr

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

numexpr 2.0rc1 does not accept empty arrays as input #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The next used to work in 1.x series, but this is what I get with numexpr 2.0rc1:

>>> import numexpr as ne
>>> import numpy as np
>>> a = np.array([])
>>> ne.evaluate('a*a')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/faltet/python/numexpr/default/<ipython console> in <module>()

/home/faltet/python/numexpr/default/numexpr/necompiler.pyc in evaluate(ex, 
local_dict, global_dict, out, order, casting, **kwargs)                         

    662         compiled_ex = _numexpr_cache[numexpr_key] = \
    663                       NumExpr(ex, signature, **context)
    664     return compiled_ex(*arguments,
    665                     out=out, order=order, casting=casting,
--> 666                     ex_uses_vml=ex_uses_vml)

ValueError: Iteration of zero-sized operands is not enabled

The responsible in the new iterator in NumPy (>= 1.6):

>>> np.nditer(a)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/faltet/python/numexpr/default/<ipython console> in <module>()

ValueError: Iteration of zero-sized operands is not enabled

I am wondering why this is so :-/

Original issue reported on code.google.com by fal...@gmail.com on 4 Nov 2011 at 3:57

GoogleCodeExporter commented 9 years ago
Implemented a solution in revision 4caa7f96b08c.

Original comment by fal...@gmail.com on 5 Nov 2011 at 5:27