More non-zero generalized eigenvalues than in theory

1 visualizzazione (ultimi 30 giorni)
Dear all,
I'm trying to compute generalized eigenvalues. First I've tried:
[V,D]=eig(A,B);
Other attempts
[V,D]=eig(A,B,'chol');
[V,D]=eig(A,B,'qz');
[V,D]=eig(A/B);
Well, my problem is that in all cases I obtain more non-zero eigenvalues than in theory. A,B are both of 42x42 size and rank(A)=2, rank(B)=41. (By the way, in case it's useful: A and B are between- and within-scatter matrices from a k=3 multiclass Linear Discriminant Analysis, i.e. three classes/groups).
Theoretically, since rank(A)=2, I would get two non-zero eigenvalues... but results are: [3.1055, 0.9127, 0.7718, etc.] All other are indeed <1e-12. I've also tried computing the scatter matrices of my data having been first transformed to zero-mean unit-stdev, but yet I get three non-negligible eigenvalues!
I don't know where the problem is. I've verified my code (mainly to check if my computation of matrices is correct) against a given example of size 6x6, and I do get two non-zero eigenvalues as expected.
Thank you very much in advance! Best regards,
Fernando

Risposta accettata

Fernando García-García
Fernando García-García il 29 Ott 2014
I think I've found the solution for this issue by using the intermediate output of the QZ algorithm.
[AA,BB,Q,Z,V,W] = qz(A,B,'real'); % in my case I think 'real' is safe, still needs a check
Right generalized eigenvectors are rows of W transposed. Eigenvales are:
D(i,i) = AA(i,i)/BB(i,i);
I guess that the code in eig() doesn't check if BB(i,i) has an aprox. 0 value, and numerical precision due to a 0/0 made an extra non-zero eigenvalue appear in my example data.
Let's see if I'm wrong or if anyone has a different explanation. Hope this helps!
  1 Commento
Fernando García-García
Fernando García-García il 29 Ott 2014
Or most problably, eig() does check if approx. 0... but in my problem (with a considerable matrix dimension but low rank), I suppose I needed a greater tolerance than the default. So I implemented by hand the
D(i,i) = AA(i,i)/BB(i,i);
checking if B(i,i)>TOL. I took TOL as big as 1e-6, because values in the order of 1e-7 appear in B's diagonal for my case.

Accedi per commentare.

Più risposte (1)

Fernando García-García
Fernando García-García il 29 Ott 2014
Sorry, it seems I read it wrong (maybe from an older version/implementation): Right generalized eigenvectors are rows of W, not W transposed.

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by