[SciPy-user] simple question about digonal matrices

Karthikesh Raju karthik at james.hut.fi
Tue May 11 04:27:41 CDT 2004


Hi All,

How does one do something as mundane as assigning value to a diagonal
vector.

D = array([1,2,3])

D_with_zeros = array([[0,0,0],
                     [0,0,0],
                     [0,0,0]])

now i want D in the diagonal of D_with_zeros, i was trying something like:
numarray.diagonal(D_with_zeros) = D

numarray is not happy with my assignment?

Warm regards
karthik








-----------------------------------------------------------------------
Karthikesh Raju,		    email: karthik at james.hut.fi
Researcher,			    http://www.cis.hut.fi/karthik
Helsinki University of Technology,  Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc.,    Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------



More information about the SciPy-user mailing list