[Numpy-tickets] [NumPy] #254: ma & numpy arithmetic not commutative
NumPy
numpy-tickets at scipy.net
Thu Aug 17 20:06:16 CDT 2006
#254: ma & numpy arithmetic not commutative
--------------------+-------------------------------------------------------
Reporter: guyer | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: normal | Keywords:
--------------------+-------------------------------------------------------
>>> numpy.__version__
'1.0b3.dev3032'
>>> import numpy
>>> from numpy.core import ma
>>> a = ma.zeros((4,1))
>>> a[2,0] = ma.masked
>>> b = numpy.zeros((4,2))
>>> a * b
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3
/site-packages/numpy/core/ma.py", line 944, in __mul__
return multiply(self, other)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3
/site-packages/numpy/core/ma.py", line 379, in __call__
return masked_array(result, m)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3
/site-packages/numpy/core/ma.py", line 1601, in masked_array
return array(a, mask=mask, copy=0, fill_value=fill_value)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3
/site-packages/numpy/core/ma.py", line 588, in __init__
raise MAError, "Mask and data not compatible."
numpy.core.ma.MAError: Mask and data not compatible.
>>> b * a
array(data =
[[ 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00]
[ 1.00000000e+20 1.00000000e+20]
[ 0.00000000e+00 0.00000000e+00]],
mask =
[[False False]
[False False]
[True True]
[False False]],
fill_value=1e+20)
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/254>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list