[Numpy-discussion] How do I make a diagonal matrix?
Alan G Isaac
aisaac at american.edu
Fri Jun 23 11:03:13 CDT 2006
On Fri, 23 Jun 2006, Keith Goodman apparently wrote:
> my x is a Nx1 matrix. I can't get it to work with matrices.
Hmm. One would think that diag() would accept a flatiter
object, but it does not. Shouldn't it??
But anyway, you can squeeze x:
[ 0.0688041 ],
array([[ 0.46474951, 0. , 0. ],
[ 0. , 0.0688041 , 0. ],
[ 0. , 0. , 0.61141623]])
More information about the Numpy-discussion