Hello,
Accurately determining when a result should be zero and when it is actually a very small number is difficult. As ttrr mentioned, there is no proper ordering for eigenvalues. If you choose to sort the eigenvalues yourself, remember that the eigenvectors correspond to a particular eigenvalue. You will need to rearrange the columns of that matrix as well.
As for sorting in general, it is really a special case when the eigenvalues of a matrix are all real. In this case, there are some obvious orderings; namely, ascending and descending. However, in the more general case, eigenvalues are usually complex. There is no truly intuitive way to sort complex numbers. Sorting by magnitude is a logical choice, but then which value should be listed first: 3+4i or -3+4i? What about 3+4i or 3-4i?
Could you provide the matrix you were looking at? We could analyze the eigenvalue computation algorithm here and possibly improve it to return 0 instead of a small non-zero number.
Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments