From: NIcholas on
Shouldn't the command "[V,D] = eig(A);" give an orthogonal basis V?
If A has unique eigenvalues I find this to be true, but if A has identical eigenvalues (see code below) the eigenvectors with identical eigenvalues seem to lose orthogonality. Is this a numerical issue with the eig command? and is there a way around it?

CODE:
rand('state',0);
[Q,R]=qr(rand(4)); % Q is a random orthogonal basis
A=Q * diag([1 2 3 3]) * Q'; % eigenvalue 3 has multiplicity 2
[V,D]=eig(A);
disp(V'*V)

1.0000 0.0000 -0.0000 -0.0000
0.0000 1.0000 0.0000 -0.0000
-0.0000 0.0000 1.0000 -0.3161
-0.0000 -0.0000 -0.3161 1.0000

If instead I give A unique eigenvalues I do get an orthogonal basis:
A=Q * diag([1 2 3 4]) * Q';
[V,D]=eig(A);
disp(V'*V)
1.0000 0.0000 0.0000 0.0000
0.0000 1.0000 -0.0000 0.0000
0.0000 -0.0000 1.0000 0.0000
0.0000 0.0000 0.0000 1.0000
From: Matt J on
"NIcholas " <dsfadfa(a)aol.com> wrote in message <i3hcrc$g9o$1(a)fred.mathworks.com>...
> Shouldn't the command "[V,D] = eig(A);" give an orthogonal basis V?
==============

If A is not Hermitian, it might not even have a fulll set of linear independent eigenvectors, making it impossible for eig() to produce an orthogonal basis.

In your example, A is Hermitian, but since eig doesn't know this in advance, it has no reason to try to orthogonalize the result.
From: Matt J on
"NIcholas " <dsfadfa(a)aol.com> wrote in message <i3hcrc$g9o$1(a)fred.mathworks.com>...

> If instead I give A unique eigenvalues I do get an orthogonal basis:
==========

Yes, the eigenvectors of a Hermitian matrix belonging to different eigenvalues are always orthogonal to each other.

A repeated eigenvalue with multiplicity M has an M-dimensional space of eigenvectors. You can orthogonalize any basis for this M-dimensional space using Gram-Schmidt, but again eig() has no reason to add this processing, not knowing whether A is Hermitian.
From: Matt J on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i3hf0q$3vk$1(a)fred.mathworks.com>...

> A repeated eigenvalue with multiplicity M has an M-dimensional space of eigenvectors. You can orthogonalize any basis for this M-dimensional space using Gram-Schmidt, but again eig() has no reason to add this processing, not knowing whether A is Hermitian.
================

eig() also has no way of detecting whether eigenvalues are repeated. The test

EigenValue1==EigenValue2

is too naive to account for floating point errors in the computation of the eigenvalues.
From: Bruno Luong on
"NIcholas " <dsfadfa(a)aol.com> wrote in message <i3hcrc$g9o$1(a)fred.mathworks.com>...
> Shouldn't the command "[V,D] = eig(A);" give an orthogonal basis V?
> If A has unique eigenvalues I find this to be true, but if A has identical eigenvalues (see code below) the eigenvectors with identical eigenvalues seem to lose orthogonality. Is this a numerical issue with the eig command? and is there a way around it?

This is not an "issue": there is no warranty that EIG must return the orthogonal basis for multiple-order eigenspace even for Hermitian matrix. Any basis vectors within the multilple-order eigenspace are still *valid* eigen-vectors.

If you want to reorthonalize, use ORTH after EIG. Or you can call SVD

[V D V] = svd(A)

Bruno
 |  Next  |  Last
Pages: 1 2 3
Prev: for loop problem
Next: mxGetData gets garbage