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 42×42 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 6×6, and I do get two non-zero eigenvalues as expected.
Thank you very much in advance! Best regards,
Fernando
Best Answer