# Eigen - Solving Complex Generalized Eigenvalue Problem

I've been using the Eigen C++ linear algebra library to solve various eigenvalue problems with complex matrices. I've recently had to use a generalized eigenvalue solution process, only to be disappointed by the fact that Eigen's

Eigen::GeneralizedEigenSolver< _MatrixType >

routine can't handle complex matrices. My matrices are generally not self-adjoint, so it appears I can't use its

Eigen::GeneralizedSelfAdjointEigenSolver< _MatrixType >

routine, either.

Is there some workaround using only C++ and Eigen that would allow me to solve this problem? For example, can I convert a pair of complex, non-Hermitian matrices into a pair of self-adjoint matrices for the generalized problem without any loss of information?

• Are you sure you're not willing to expand beyond "eigen"? There are many other options! – Spencer Bryngelson Aug 14 '16 at 3:19
• It would be unfortunate if I did, since I'll essentially require C++, and have invested a significantly large amount of time in adapting my process for Eigen. I also thought Eigen was highly recommended - is there a more suitable library you would recommend? – Stuart Barth Aug 15 '16 at 4:01
• This is the sunk cost fallacy! I typically recommend SLEPc as it is very versatile and scalable. Other options include ARPACK and LAPACK. Which you choose will depend on the details of your problem (size, which eigenvalues and vectors you need, and so fourth). – Spencer Bryngelson Aug 15 '16 at 6:27
• Sunk Cost Fallacy... ya, I suppose it is. Thanks, I'll check those out :[ – Stuart Barth Aug 16 '16 at 1:07

If one of the matrices is invertible, you can convert it to a standard eigenvalue problem $(B^{-1}A) x = \lambda x$. With Eigen, you can thus do:
EigenSolver<MatrixXcd> eig(B.lu().solve(A));

and, if needed, you can also re-normalize the eigenvectors so that $x^T B x = 1$.