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: >>> x matrix([[ 0.46474951], [ 0.0688041 ], [ 0.61141623]]) >>> y=N.diag(N.squeeze(x.A)) >>> y array([[ 0.46474951, 0. , 0. ], [ 0. , 0.0688041 , 0. ], [ 0. , 0. , 0.61141623]]) hth, Alan Isaac Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion