[Scipy-tickets] [SciPy] #1005: scipy.linalg.svd and scipy.linalg.qr choke at empty arrays

SciPy Trac scipy-tickets@scipy....
Sun Nov 28 09:48:12 CST 2010


#1005: scipy.linalg.svd and scipy.linalg.qr choke at empty arrays
--------------------------+-------------------------------------------------
 Reporter:  chtito        |       Owner:  somebody  
     Type:  defect        |      Status:  needs_info
 Priority:  normal        |   Milestone:  0.9.0     
Component:  scipy.linalg  |     Version:  0.7.0     
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by rgommers):

  * status:  new => needs_info


Comment:

 First of all, I think you would expect an exception. Right?

 Second, your example is very artificial - an empty array with shape (0,2).
 With an empty array of shape () you get an informative error message:
 {{{
 >>> a
 array([], shape=(0, 2), dtype=float64)
 >>> a.shape
 (0, 2)
 >>> a = np.array([])
 >>> sl.qr(a) # exception!
 ------------------------------------------------------------
 Traceback (most recent call last):
   File "<ipython console>", line 1, in <module>
   File "/Users/rgommers/Code/scipy/scipy/linalg/decomp_qr.py", line 81, in
 qr
     raise ValueError("expected 2D array")
 ValueError: expected 2D array

 >>> sl.svd(a) # exception!
 ------------------------------------------------------------
 Traceback (most recent call last):
   File "<ipython console>", line 1, in <module>
   File "/Users/rgommers/Code/scipy/scipy/linalg/decomp_svd.py", line 74,
 in svd
     raise ValueError('expected matrix')
 ValueError: expected matrix
 }}}

 So I think this ticket can be closed.

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


More information about the Scipy-tickets mailing list