I need to obtain the Eigenvectors of a general complex matrix, but with quadruple precision. Is anyone aware of a means to do this?

I currently use Tux Eigen, and I see that in their unsupported modules, they offer arbitrary precision using MPFR C++, however this appears to be for real numbers only. Perhaps this could be augmented to complex numbers in some way?

Thanks in advance

  • $\begingroup$ You might try boost.multiprecision with Eigen. $\endgroup$
    – user14717
    Nov 1, 2019 at 12:17
  • $\begingroup$ @user14717 thanks for the suggestion, but boost::multiprecision appears not to play nicely with Eigen, unless there is a way that I am not aware of $\endgroup$
    – AlexD
    Nov 1, 2019 at 19:31
  • $\begingroup$ I've never had a problem using boost::multiprecision with Eigen. $\endgroup$
    – user14717
    Nov 1, 2019 at 19:48
  • $\begingroup$ the simple lines; typedef Matrix<boost::multiprecision::complex128, Dynamic, Dynamic> MatrixXcmp; MatrixXcmp C = MatrixXcmp::Random(8,8); cout<<C<<endl; invoke several errors starting with; Eigen/src/Core/NumTraits.h:34:20: error: no matching function for call to ‘ceil(boost::multiprecision::number<boost::multiprecision::backends::complex_adaptor<boost::multiprecision::backends::float128_backend>, (boost::multiprecision::expression_template_option)0>)’ return int(ceil(-log10(NumTraits<Real>::epsilon()))); ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $\endgroup$
    – AlexD
    Nov 1, 2019 at 19:58
  • $\begingroup$ using std::ceil? $\endgroup$
    – user14717
    Nov 1, 2019 at 20:08

1 Answer 1


It transpires that it is reasonably straightforward to utilise MPFR C++ complex numbers within Tux Eigen;

#include <iostream>
#include <cmath>
#include <Eigen/Dense>
#include <Eigen/Eigenvalues>
#include <Eigen/LU>
#include <unsupported/Eigen/MPRealSupport>
#include <iomanip>

using namespace Eigen;
using namespace std;
using namespace mpfr;

int main(){
  // set precision to 128 bits (double has only 53 bits)
  typedef Matrix<complex<mpreal>, Dynamic, Dynamic> MatrixXcmp;
  MatrixXcmp C = MatrixXcmp::Random(8,8);
  ComplexEigenSolver<MatrixXcmp> ces;
  return 0;

one first needs to obtain MPFR C++, available at http://www.holoborodko.com/pavel/mpfr/#download which depends on MPFR available at https://www.mpfr.org/mpfr-current/#download which in turn depends on GMP available at https://gmplib.org/#DOWNLOAD

Then the code needs to be linked with -lgmp and -lmpfr.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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