user2820579
user2820579

Reputation: 3451

Rearrange eigenvector matrix order when using ZHEEVD

I noticed that when one uses the lapack subroutine ZHEEVD (or ZHEEV) the eigenvector matrix arrangement does not correspond to the eigenvalue ordering. By this, for example, I mean:

E = [E_1,E_2,E_3]

V = [v_3,v_2,v_1]

I can provide an example if needed but the question is simple: Is there some way to rearrange the eigenvector matrix such that

H*v_i = E_i*v_i

(where H is a symmetric real matrix, v_i is the eigenvector associated to the eigenvalues E_i) eigenvalue-eigenvector correspond inside the lapack subroutines?

Upvotes: 1

Views: 578

Answers (1)

Alexander Vogt
Alexander Vogt

Reputation: 18118

I'm a little surprised that the eigenvectors are not in the order of the eigenvalues, but you could try ZHEEVX. According to the documentation,

the first M columns of Z contain the orthonormal eigenvectors of the matrix A corresponding to the selected eigenvalues, with the i-th column of Z holding the eigenvector associated with W(i).

Of course, the syntax is a little more involved...

Upvotes: 1

Related Questions