Eigen::NumTraits< mpfr::mpreal > Struct Reference
+ Inheritance diagram for Eigen::NumTraits< mpfr::mpreal >:

Public Types

enum  {
  IsInteger ,
  IsSigned ,
  IsComplex ,
  RequireInitialization ,
  ReadCost ,
  AddCost ,
  MulCost
}
 
typedef mpfr::mpreal NonInteger
 
typedef mpfr::mpreal Real
 
- Public Types inherited from Eigen::GenericNumTraits< mpfr::mpreal >
typedef T Real
 

Static Public Member Functions

static Real Catalan (long Precision=mpfr::mpreal::get_default_prec())
 
static Real dummy_precision ()
 
static Real epsilon (const Real &x)
 
static Real epsilon (long Precision=mpfr::mpreal::get_default_prec())
 
static Real Euler (long Precision=mpfr::mpreal::get_default_prec())
 
static Real highest (long Precision=mpfr::mpreal::get_default_prec())
 
static Real Log2 (long Precision=mpfr::mpreal::get_default_prec())
 
static Real lowest (long Precision=mpfr::mpreal::get_default_prec())
 
static Real Pi (long Precision=mpfr::mpreal::get_default_prec())
 

Additional Inherited Members

- Public Attributes inherited from Eigen::GenericNumTraits< mpfr::mpreal >
 AddCost
 
 IsComplex
 
 IsInteger
 
 IsSigned
 
 MulCost
 
 ReadCost
 
 RequireInitialization
 

Detailed Description

\defgroup MPRealSupport_Module MPFRC++ Support module
\code
#include <Eigen/MPRealSupport>
\endcode

This module provides support for multi precision floating point numbers
via the <a href="http://www.holoborodko.com/pavel/mpfr">MPFR C++</a>
library which itself is built upon <a href="http://www.mpfr.org/">MPFR</a>/<a href="http://gmplib.org/">GMP</a>.

\warning 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/LU>
using namespace mpfr;
using namespace Eigen;
int main()
{
// set precision to 256 bits (double has only 53 bits)
mpreal::set_default_prec(256);
// 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 = A.lu().solve(b);
std::cout << "relative error: " << (A*x - b).norm() / b.norm() << std::endl;
return 0;
}
int main()
Definition: BVH_Example.cpp:25
SparseMatrix< double > A(n, n)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend

Definition at line 62 of file MPRealSupport.

Member Typedef Documentation

◆ NonInteger

typedef mpfr::mpreal Eigen::NumTraits< mpfr::mpreal >::NonInteger

Definition at line 76 of file MPRealSupport.

◆ Real

typedef mpfr::mpreal Eigen::NumTraits< mpfr::mpreal >::Real

Definition at line 75 of file MPRealSupport.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
IsInteger 
IsSigned 
IsComplex 
RequireInitialization 
ReadCost 
AddCost 
MulCost 

Definition at line 65 of file MPRealSupport.

Member Function Documentation

◆ Catalan()

static Real Eigen::NumTraits< mpfr::mpreal >::Catalan ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 85 of file MPRealSupport.

85 { return mpfr::const_catalan(Precision); }

◆ dummy_precision()

static Real Eigen::NumTraits< mpfr::mpreal >::dummy_precision ( )
inlinestatic

Definition at line 98 of file MPRealSupport.

99  {
100  mpfr_prec_t weak_prec = ((mpfr::mpreal::get_default_prec()-1) * 90) / 100;
101  return mpfr::machine_epsilon(weak_prec);
102  }

◆ epsilon() [1/2]

static Real Eigen::NumTraits< mpfr::mpreal >::epsilon ( const Real x)
inlinestatic

Definition at line 88 of file MPRealSupport.

88 { return mpfr::machine_epsilon(x); }

◆ epsilon() [2/2]

static Real Eigen::NumTraits< mpfr::mpreal >::epsilon ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 87 of file MPRealSupport.

87 { return mpfr::machine_epsilon(Precision); }

◆ Euler()

static Real Eigen::NumTraits< mpfr::mpreal >::Euler ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 83 of file MPRealSupport.

83 { return mpfr::const_euler(Precision); }

◆ highest()

static Real Eigen::NumTraits< mpfr::mpreal >::highest ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 78 of file MPRealSupport.

78 { return mpfr::maxval(Precision); }

◆ Log2()

static Real Eigen::NumTraits< mpfr::mpreal >::Log2 ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 84 of file MPRealSupport.

84 { return mpfr::const_log2(Precision); }

◆ lowest()

static Real Eigen::NumTraits< mpfr::mpreal >::lowest ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 79 of file MPRealSupport.

79 { return -mpfr::maxval(Precision); }

◆ Pi()

static Real Eigen::NumTraits< mpfr::mpreal >::Pi ( long  Precision = mpfr::mpreal::get_default_prec())
inlinestatic

Definition at line 82 of file MPRealSupport.

82 { return mpfr::const_pi(Precision); }

The documentation for this struct was generated from the following file: