[Numpy-discussion] Sort , Complex array

Konrad Hinsen hinsen at cnrs-orleans.fr
Mon Nov 26 02:46:02 CST 2001


Nils Wagner <nwagner at mecha.uni-stuttgart.de> writes:

> How can I sort an array of complex eigenvalues with respect to the
> imaginary part
> (in ascending order) in Numpy ?
> All eigenvalues appear in complex cunjugate pairs.

indices = argsort(eigenvalues.imag)
eigenvalues = take(eigenvalues, indices)

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