I have a list of matrices and want to obtain a list of eigenvectors and eigenvalues for each matrix, both sorted by the size of the eigenvalue. If I write system={eigenvalues, eigenvectors}
, where eigenvalues
is a list of lists of eigenvalues for each of the matrices, I would like to sort the eigenvectors by writing
Map[Sort[#, #1[[1]] < #2[[1]]] &, Transpose[system]]
of some sort, but this does nothing useful.
Answer
Ordering[Norm /@ Last @ N[Eigensystem[system]]];
gives you the ordering by norm. You can apply this on your eigenvalues and eigenvectors, e.g.
Eigenvectors[system][[%]]
EDIT
To apply this on a list of matrices:
(# &@Ordering[Norm /@ N[#]]) & /@ Eigenvectors[#] & /@ {mat1,mat2,...,matn}
Comments
Post a Comment