[Numpy-discussion] complex diagonal matrix

baecker at physik.tu-dresden.de baecker at physik.tu-dresden.de
Sun Jan 26 02:41:02 EST 2003


Hi,

I just wondered if there is a "nicer" way of generating
a complex diagonal matrix than
  a)
     v=arange(10,typecode=Complex)
     mat=diag(v)
  b)
     v=arange(10)
     mat=diag(v)+0j

Namely, wouldn't something like
  v=arange(10)
  mat=diag(v,typecode=Complex)
be nicer?

BTW: I somehow found that in the (excellent) documentation
of Numeric the definitions from Mlab.py are a bit hidden.
In my case I know nothing about matlab and I somehow expected
that this type of routines are to be found in the section
(together with zeros,ones etc. etc....)
Also diag is not listed in the index
 http://www.pfdubois.com/numpy/html2/numpy-22.html#A
or ?

Arnd





More information about the NumPy-Discussion mailing list