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.

  • $\begingroup$ Please provide system. Looks like you got some surplus & there as well. $\endgroup$ – Yves Klett Oct 13 '14 at 11:39
  • $\begingroup$ @ joe8: the function Eigensystem[m] gives you {List of eigenvectors, List of Eigenvalues}. You can use Norm[] to check the order of the eigenvectors. As far as I have seen in some examples they are ordered in descending order. $\endgroup$ – Dr. Wolfgang Hintze Oct 13 '14 at 12:01
  • $\begingroup$ @ybeltukov: I meant to sort by the size of the eigenvalue; corrected my mistake. $\endgroup$ – joe8 Oct 13 '14 at 20:51
  • $\begingroup$ @joe8 OK, now it is well posed problem. Do this answer your question? $\endgroup$ – ybeltukov Oct 13 '14 at 20:54
Ordering[Norm /@ Last @ N[Eigensystem[system]]];

gives you the ordering by norm. You can apply this on your eigenvalues and eigenvectors, e.g.



To apply this on a list of matrices:

(# &@Ordering[Norm /@ N[#]]) & /@ Eigenvectors[#] & /@ {mat1,mat2,...,matn}
  • $\begingroup$ this solutions seems to work for a single matrix, but not for a list of several matrices. I am unable to generalize it to my problem. $\endgroup$ – joe8 Oct 13 '14 at 20:58
  • $\begingroup$ I guess the questions then is whether Ordering can be used on sublists only. $\endgroup$ – joe8 Oct 13 '14 at 21:06
  • $\begingroup$ That should not be a huge problem; you can wrap the above in a function and then apply that to your list of matrices, but before I update my answer, please clarify if you want to sort the eigenvectors per matrix, or the matrixes based on their eigenvector norms. If the latter, can I assume sorting is based on largest eigenvector norm? $\endgroup$ – Sander Oct 13 '14 at 23:59
  • $\begingroup$ I want to sort per matrix. $\endgroup$ – joe8 Oct 14 '14 at 11:59
  • $\begingroup$ updated to accommodate per matrix sorting. $\endgroup$ – Sander Oct 14 '14 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.