From: Alan G I. <ai...@am...> - 2006-06-23 15:55:33
|
On Fri, 23 Jun 2006, Keith Goodman apparently wrote:=20 > my x is a Nx1 matrix. I can't get it to work with matrices.=20 Hmm. One would think that diag() would accept a flatiter=20 object, but it does not. Shouldn't it?? But anyway, you can squeeze x: >>> x matrix([[ 0.46474951], [ 0.0688041 ], [ 0.61141623]]) >>> y=3DN.diag(N.squeeze(x.A)) >>> y array([[ 0.46474951, 0. , 0. ], [ 0. , 0.0688041 , 0. ], [ 0. , 0. , 0.61141623]]) hth, Alan Isaac |