Eigenvalue computation for large matrix
2 views (last 30 days)
Show older comments
Hi there -
I want to compute the eigenvalues of the matrix (1/T)*A'A, where A is a Txn matrix.
Here is my code:
T = 5;
n = 4;
A = randn(T,n);
c = T\(A'*A);
c1 = T\A'*A;
[W, lambda] = eig(c); % columns of W contain eigenvectors
[W1, lambda1] = eig(c1); % columns of W contain eigenvectors
Clearly, c and c1 are the same matrices since I'm only premultiplying the scalar (1/T). However, the eigenvalues in lambda are in different ordering than those in lambda1. Moreover, if I set
T = 50
n = 450
the elements in lambda1 become complex while those in lambda remain real.
I'd very much appreciate if somebody could help me out here and let me know what I'm missing.
Thanks, Peter
0 Comments
Answers (1)
Torsten
on 19 Jul 2016
For the problem with complex eigenvalues, see what happens if you set c1=0.5*(c1+c1') before calling "eig".
Best wishes
Torsten.
1 Comment
Peter
on 19 Jul 2016
Edited: Peter
on 19 Jul 2016
In this case the eigenvalues become real and the ordering in lambda and lambda1 also coincide.
It seems to be a numerical problem in the computation of c1 that screws up the symmetry of that matrix and, in turn, the eigenvalues. Do you have any idea why this is so? I'm not exactly a numerical wizard, but I guess it's related to building the inverse of T.
Thanks!
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!