Reputation: 41
I am trying to solve the generalized eigenvalue problem A.c = (lam).B.c where A and B are nxn matrices and c is nx1 vector. (lam) is the eigenvalue.
I am using python. I tried something like eig(dot(inv(B),A)) from numpy.linalg but it turns out to be VERY unstable in my problem since it involves inversion. So I have been reading that it is possible to do it in MATLAB but I couldn't find any function or method to do it in python. Any ideas would be greatly appreciated. Thanks...
Upvotes: 2
Views: 3841
Reputation: 18653
Why don't you try using scipy? It has a method in it's linear algebra module scipy.linalg.eig that can be used to "solve an ordinary or generalized eigenvalue problem."
scipy.linalg.eig(a, b=None, left=False, right=True, overwrite_a=False, overwrite_b=False)[source]
Solve an ordinary or generalized eigenvalue problem of a square matrix.
Find eigenvalues w and right or left eigenvectors of a general matrix:
a vr[:,i] = w[i] b vr[:,i]
a.H vl[:,i] = w[i].conj() b.H vl[:,i]
where .H is the Hermitean conjugation.
Upvotes: 6