[NumPy-Tickets] [NumPy] #1417: diag returns ndarray

NumPy Trac numpy-tickets@scipy....
Sun Feb 28 09:57:01 CST 2010


#1417: diag returns ndarray
----------------------+-----------------------------------------------------
 Reporter:  uhrm      |       Owner:  pierregm
     Type:  defect    |      Status:  new     
 Priority:  normal    |   Milestone:          
Component:  numpy.ma  |     Version:  1.4.0   
 Keywords:            |  
----------------------+-----------------------------------------------------
 When called with a {{{matrix}}} object, {{{diag}}} return an
 {{{ndarray}}}.

 Example:

 {{{
 >>> B = numpy.matrix("1.7 2.2 0.3; 1.2 0.2 0.0; 1.0 1.0 0.7; 0.3 0.3 0.2")
 >>> B
 matrix([[ 1.7,  2.2,  0.3],
         [ 1.2,  0.2,  0. ],
         [ 1. ,  1. ,  0.7],
         [ 0.3,  0.3,  0.2]])
 >>> d = numpy.diag(B)
 >>> d
 array([ 1.7,  0.2,  0.7])
 }}}

 If I understand correctly, the return type should also be a {{{matrix}}}.
 Since {{{matrix}}} is always 2 dimensional, question is whether it's a
 column or row vector (I'd prefer a column vector).

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1417>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list