[Numpy-discussion] complex diagonal matrix
Konrad Hinsen
hinsen at cnrs-orleans.fr
Sun Jan 26 03:11:02 CST 2003
baecker at physik.tu-dresden.de writes:
> 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?
Why would that be nicer?
Personally, I prefer to have explicit typecodes limited to a very
small number of array generators, and have all other functions apply
the standard type-preservation rules.
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------
More information about the Numpy-discussion
mailing list