I am interested in finding out the maximum or minimum eigenvalue of a
real symmetric matrix. If I know the eigenvalues are automatically
sorted by eig, I do not have to use any max or min function after
executing eig.
In the following example, the eigenvalues (the diagonal of the
diagonal matrix D) are always sorted.
K = randn(4,4);
K = K + K';
[U,D] = eig (K);
However, if I define
K2 = U*abs(D)*U';
then eig(K2) will not do any sorting.
For instance, if D = diag([-5,-4,1,2]) in the example, eig(K2) will
simply return 5, 4, 1, 2.
It seems that different subroutines have been invoked for K and K2.
How can I know what they are?
Having said all of that, max and min should be pretty cheap. Life's short,
maybe too short to depend on something like that never changing, unless it's
a documented feature. SVD, for example, guarantees sorted singular values.
--
Mike
"Yang" <yan...@hotmail.com> wrote in message
news:ef4eb...@webcrossing.raydaftYaTP...
"Michael Hosea" <mho...@mathworks.com> wrote in message
news:ernrsp$nhn$1...@fred.mathworks.com...
Thanks. You answered my question perfectly. I did not realize that
the matrix K2 = U*abs(D)*U' was considered asymmetric by the
interface function eig simply because of the round-off errors and I
did not expect the answer was so simple.
Thanks again,
Yang