[Scipy-tickets] [SciPy] #1128: linalg.block_diag add atleast_2d

SciPy Trac scipy-tickets@scipy....
Tue Mar 9 08:36:32 CST 2010


#1128: linalg.block_diag  add atleast_2d
--------------------------+-------------------------------------------------
 Reporter:  josefpktd     |       Owner:  somebody
     Type:  defect        |      Status:  new     
 Priority:  normal        |   Milestone:  0.8.0   
Component:  scipy.linalg  |     Version:  0.7.0   
 Keywords:                |  
--------------------------+-------------------------------------------------
 scipy.linalg.block_diag does not work with components that are not 2d

 if input arguments are converted with np.atleast_2d, then this would also
 work with scalar or 1d arguments.


 {{{
 >>> scipy.linalg.block_diag(1,2)
 Traceback (most recent call last):
   File "\Programs\Python25\Lib\site-packages\scipy\linalg\basic.py", line
 892, in block_diag
 ValueError: need more than 0 values to unpack
 >>> scipy.linalg.block_diag([1],[2])
 Traceback (most recent call last):
   File "\Programs\Python25\Lib\site-packages\scipy\linalg\basic.py", line
 892, in block_diag
 ValueError: need more than 1 value to unpack
 >>> scipy.linalg.block_diag([[1]],[[2]])
 array([[1, 0],
        [0, 2]])
 }}}

 also traceback if a component is 3d is not informative

 {{{
 >>> scipy.linalg.block_diag([[1]],[[[2]]])
 Traceback (most recent call last):
   File "\Programs\Python25\Lib\site-packages\scipy\linalg\basic.py", line
 888, in block_diag
 ValueError: setting an array element with a sequence.
 }}}

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


More information about the Scipy-tickets mailing list