Charles R Harris schrieb: > Hi Sven, > > On 7/28/06, *Sven Schreiber* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Here's my attempt at summarizing the diag-discussion. > > > <snip> > > 2) Deprecate the use of diag which is overloaded with making diagonal > matrices as well as getting diagonals. Instead, use the existing > .diagonal() for getting a diagonal, and introduce a new make_diag() > function which could easily work for numpy-arrays and numpy-matrices > alike. > > > This would be my preference, but with functions {get,put}diag. We could > also add a method or function asdiag, which would always return a > diagonal matrix made from *all* the elements of the matrix taken in > order. For (1,n) or (n,1) this would do what you want. For other > matrices the result would be something new and probably useless, but at > least it wouldn't hurt. >
This seems to have been implemented now by the new diagflat() function. So, matrix users can now use m.diagonal() for the matrix->vector direction of diag(), and diagflat(v) for the vector->matrix side of diag(), and always get numpy-matrix output for numpy-matrix input. Thanks a lot for making this possible! One (really minor) comment: "diagflat" as a name is not optimal imho. Are other suggestions welcome, or is there a compelling reason for this name? Thanks, sven ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion