[Numpy-tickets] [NumPy] #347: qr only works for square matrices

NumPy numpy-tickets at scipy.net
Mon Oct 16 03:45:10 CDT 2006

#347: qr only works for square matrices
 Reporter:  bartvde       |       Owner:  somebody
     Type:  defect        |      Status:  new     
 Priority:  normal        |   Milestone:          
Component:  numpy.linalg  |     Version:          
 Severity:  major         |    Keywords:          
 The qr method doesn't work for non-square matrices. In addition, there is
 no unit-test for the qr-method.
 The scipy.linalg.qr method works fine.

 In [15]: a=numpy.random.rand(6,5)
 In [16]: q,r=numpy.linalg.qr(a)
 exceptions.ValueError                                Traceback (most
 recent call last)

 /home/bartvde/Documents/ADI/python/<ipython console>

 /home/bartvde/Local/lib/python/numpy/linalg/linalg.py in qr(a, mode)
     307     r = zeros((mn,n), result_t)
     308     for i in range(mn):
 --> 309             r[i, i:] = atemp[i, i:]
     311     #  'r'-mode, that is, calculate only r

 ValueError: shape mismatch: objects cannot be broadcast to a single shape

Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/347>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list