All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
MPFRC++ Support module
* #include <Eigen/MPRealSupport>

This module provides support for multi precision floating point numbers via the MPFR C++ library which itself is built upon MPFR/GMP.

MPFR C++ is licensed under the GPL.

You can find a copy of MPFR C++ that is known to be compatible in the unsupported/test/mpreal folder.

Here is an example:

#include <iostream>
#include <Eigen/MPRealSupport>
#include <Eigen/LU>
using namespace mpfr;
using namespace Eigen;
int main()
// set precision to 256 bits (double has only 53 bits)
// Declare matrix and vector types with multi-precision scalar type
typedef Matrix<mpreal,Dynamic,Dynamic> MatrixXmp;
typedef Matrix<mpreal,Dynamic,1> VectorXmp;
MatrixXmp A = MatrixXmp::Random(100,100);
VectorXmp b = VectorXmp::Random(100);
// Solve Ax=b using LU
VectorXmp x =;
std::cout << "relative error: " << (A*x - b).norm() / b.norm() << std::endl;
return 0;