I’m using the Lapack routine zgeev to obtain the (complex) eigenvalues and
eigenvectors of a non-symmetric complex matrix in Fortran. The resulting array
of eigenvectors is in some arbitrary order. I would like to reorder both the
array of eigenvalues and the corresponding columns in the matrix of eigenvectors
so that the eigenvalues are in ascending order with respect to the real part of
each eigenvalue. I could of course roll my own sorting routine, but I was
wondering if there was already a Fortran routine somewhere that can do this for
me, maybe even as part of lapack.
I’m using the Lapack routine zgeev to obtain the (complex) eigenvalues and eigenvectors of
Share
You could just look at the end of zsteqr.f (the hermitian tridigaonal solver) and generalise that. The relevant bit of code is
So I think you just have to change the comparison line (but untested)
Ian