[Scipy-tickets] [SciPy] #609: Transposed array cannot be reshaped without a copy

SciPy scipy-tickets@scipy....
Thu Feb 21 11:52:26 CST 2008


#609: Transposed array cannot be reshaped without a copy
--------------------+-------------------------------------------------------
 Reporter:  sputta  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  0.7     
Component:  Other   |     Version:          
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 Changing the shape of an array created from the transpose of another array
 is throwing an exception. I am guessing this touches upon function other
 than transpose.

 The following illustrates the problem.

 >>> print numpy.__version__
 1.0.1
 >>> x = numpy.zeros((4,5), numpy.float)
 >>> y = numpy.transpose(x)
 >>> x.shape = 20
 >>> y.shape
 (5, 4)
 >>> y.shape = 20
 Traceback (most recent call last):
   File "<string>", line 1, in <string>
 AttributeError: incompatible shape for a non-contiguous array
 >>> y = y.copy()
 >>> y.shape = 20
 >>>

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/609>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list