Generalized eigenvalue problem
I'm trying to convert a generalized eigenvalue problem into a normal eigenvalue calculation.
I have this code:
[V开发者_如何学Go,D,flag] = eigs(A, T);
Now I convert it into:
A1 = inv(T)*A;
[V1,D1,flag1] = eigs(A1);
Shouldn't I get the same result? From what I understand in the Matlab documentation, the first equation solves:
A*V = B*V*D
and the second one solves:
A*V = V*D
am I missing something?
Thanks!!
A quick example:
A = rand(4); B = randn(4); B = B'*B; %'# some matrices
[VV,DD] = eig(B\A);
[V,D] = eigs(A,B);
V = bsxfun(@rdivide, V, sqrt(sum(V.*V))); %# make: norm(V(:,i))==1
The result:
V =
-0.64581 0.8378 0.77771 0.50851
0.70571 -0.51601 -0.32503 -0.70623
0.27278 0.076874 -0.51777 0.25359
0.10245 0.16095 -0.14641 -0.42232
VV =
-0.64581 0.8378 -0.77771 -0.50851
0.70571 -0.51601 0.32503 0.70623
0.27278 0.076874 0.51777 -0.25359
0.10245 0.16095 0.14641 0.42232
D =
17.088 0 0 0
0 0.27955 0 0
0 0 -0.16734 0
0 0 0 0.027889
DD =
17.088 0 0 0
0 0.27955 0 0
0 0 -0.16734 0
0 0 0 0.027889
Note: The eigenvalues are not always sorted the same, also the sign convention might be different...
First check if T
is invertible. Second, I'm sure D = D1
and that V = V1
up to a scale factor. Check if each column of V1
is the same as the corresponding column of V
up to a scale factor (i.e. look at V./V1
).
精彩评论