[Numpy-discussion] fixing diag() for matrices

Charles R Harris charlesr.harris at gmail.com
Sat Jul 29 12:32:49 CDT 2006

Hi Sven,

On 7/28/06, Sven Schreiber <svetosch at gmx.net> wrote:
> Here's my attempt at summarizing the diag-discussion.


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060729/cb7231fd/attachment-0001.html 

More information about the Numpy-discussion mailing list