[NumPy-Tickets] [NumPy] #2035: Broadcasting with masked array doesn't work with divide (after tile instruction)

NumPy Trac numpy-tickets@scipy....
Thu Feb 2 08:58:18 CST 2012


#2035: Broadcasting with masked array doesn't work with divide (after tile
instruction)
------------------------------+---------------------------------------------
 Reporter:  elephantterrible  |       Owner:  somebody
     Type:  defect            |      Status:  new     
 Priority:  normal            |   Milestone:  1.6.2   
Component:  Other             |     Version:  1.6.1   
 Keywords:                    |  
------------------------------+---------------------------------------------

Comment(by bsouthey):

 The error appears to be in call to 'numpy.core.numeric.array' at line 827
 numpy/lib/shape_base.py:
 {{{
 c = _nx.array(A,copy=False,subok=True,ndmin=d)
 }}}
 Also, setting 'copy=True' in the call does not change anything.
 {{{
 >>> import numpy as np
 >>> np.__version__
 '2.0.0.dev-55472ca'
 >>> import numpy.core.numeric as _nx
 >>> b=np.ma.array([[1,2,3],[4,5,6]], mask=[[1,0,0],[1,0,0]])
 >>> d=4
 >>> c = _nx.array(b,copy=True,subok=True,ndmin=d)
 >>> b/4
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3654,
 in __div__
     return divide(self, other)
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 1078,
 in __call__
     m |= ma
 ValueError: non-broadcastable output operand with shape (2,3) doesn't
 match the broadcast shape (1,1,2,3)
 >>> c = _nx.array(b,copy=False,subok=True,ndmin=d)
 >>> b/4
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3654,
 in __div__
     return divide(self, other)
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 1078,
 in __call__
     m |= ma
 ValueError: non-broadcastable output operand with shape (2,3) doesn't
 match the broadcast shape (1,1,2,3)
 >>>
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2035#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list