1
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ Are you sure you're not willing to expand beyond "eigen"? There are many other options! $\endgroup$
    – user20857
    Aug 14, 2016 at 3:19
  • $\begingroup$ 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? $\endgroup$ Aug 15, 2016 at 4:01
  • $\begingroup$ 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). $\endgroup$
    – user20857
    Aug 15, 2016 at 6:27
  • $\begingroup$ Sunk Cost Fallacy... ya, I suppose it is. Thanks, I'll check those out :[ $\endgroup$ Aug 16, 2016 at 1:07

1 Answer 1

1
$\begingroup$

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$.

$\endgroup$
2
  • 1
    $\begingroup$ This is certainly not a favorable solution if the problem is large. $\endgroup$
    – user20857
    Aug 13, 2016 at 22:36
  • $\begingroup$ Unfortunately, invertibility is not guaranteed (and it is usually not the case, hence the need for the generalized solution). $\endgroup$ Aug 14, 2016 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.