Incompatibility betwewn numarray 1.2.2 and Numeric
![](https://secure.gravatar.com/avatar/7dd64dbe40f809b9f8276bde56c872fd.jpg?s=120&d=mm&r=g)
Numeric and numarray arrays became incopatible --- Is it a bug or a design change? In [10]: import Numeric as N In [11]: A = N.arange(6.0) In [12]: import numarray as n In [13]: a = n.arange(6.0) In [14]: a+A # numarray op Numeric --------------------------------------------------------------------------- exceptions.ValueError Traceback (most recent call last) /tmp/numarray-1.2.2/<console> /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py in __add__(self, operand) 933 return operand.__radd__(self) 934 else: --> 935 return ufunc.add(self, operand) 936 937 def __radd__(self, operand): /usr/local/lib/python2.4/site-packages/numarray/ufunc.py in _cache_miss2(self, n1, n2, out) 918 919 def _cache_miss2(self, n1, n2, out): --> 920 (in1, in2), inform, scalar = _inputcheck(n1, n2) 921 922 mode, win1, win2, wout, cfunc, ufargs = \ /usr/local/lib/python2.4/site-packages/numarray/ufunc.py in _inputcheck(*inargs) 374 # see if it can be made into an array 375 try: --> 376 inarg = _nc.array(inarg) 377 except TypeError: 378 raise TypeError( /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py in array(sequence, typecode, copy, savespace, type, shape) 399 if shape is None: 400 shape=() --> 401 return fromlist([sequence],type,shape) 402 403 def asarray(seq, type=None, typecode=None): /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py in fromlist(seq, type, shape, check_overflow, typecode) 245 tshape = _frontseqshape(seq) 246 if shape is not None and _gen.product(shape) != _gen.product(tshape): --> 247 raise ValueError("shape incompatible with sequence") 248 ndim = len(tshape) 249 if ndim <= 0: ValueError: shape incompatible with sequence In [15]: A+a # The other way around --------------------------------------------------------------------------- exceptions.ValueError Traceback (most recent call last) /tmp/numarray-1.2.2/<console> /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py in __radd__(self, operand) 940 return operand.__add__(self) 941 else: --> 942 r = ufunc.add(operand, self) 943 if isinstance(r, NumArray): 944 r.__class__ = self.__class__ /usr/local/lib/python2.4/site-packages/numarray/ufunc.py in _cache_miss2(self, n1, n2, out) 918 919 def _cache_miss2(self, n1, n2, out): --> 920 (in1, in2), inform, scalar = _inputcheck(n1, n2) 921 922 mode, win1, win2, wout, cfunc, ufargs = \ /usr/local/lib/python2.4/site-packages/numarray/ufunc.py in _inputcheck(*inargs) 374 # see if it can be made into an array 375 try: --> 376 inarg = _nc.array(inarg) 377 except TypeError: 378 raise TypeError( /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py in array(sequence, typecode, copy, savespace, type, shape) 399 if shape is None: 400 shape=() --> 401 return fromlist([sequence],type,shape) 402 403 def asarray(seq, type=None, typecode=None): /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py in fromlist(seq, type, shape, check_overflow, typecode) 245 tshape = _frontseqshape(seq) 246 if shape is not None and _gen.product(shape) != _gen.product(tshape): --> 247 raise ValueError("shape incompatible with sequence") 248 ndim = len(tshape) 249 if ndim <= 0: ValueError: shape incompatible with sequence -------------------------- Nadav.
participants (2)
-
Nadav Horesh
-
Todd Miller