LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

eigenvalue order

when I perform an eigen analysis mathscript gives the values as 0, 9, 0  (actually the first zero is -4.4e-16 and the second zero is 3.88e-32)  whereas matlab gives 0,0,9.  Is there a proper order in which the values are reported?
0 Kudos
Message 1 of 3
(7,163 Views)
Hi,
There is no proper order for eigenvalues returned. It depends on your input matrix. If you want the eigenvalues in ascending order, you must sort them by yourself.
0 Kudos
Message 2 of 3
(7,158 Views)
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
0 Kudos
Message 3 of 3
(7,126 Views)