Add multi-precision type MPFRField based on mpreal and mpfr
Summary
In addition to the outdated GMPField
class a new multi-precision field type MPFRField
, based on the mpfr::mpreal
class from the MPFR-C++ library, is added.
Motivation
The old gmpcxx library lacks some implementations, e.g. of numeric_limits
. Since the GMP library also recommends to switch to the (more up-to-date) library MPFR (See https://gmplib.org/manual/Floating_002dpoint-Functions.html and https://www.mpfr.org) for floating point arithmetic, I switched the backend from GMP to MPFR. The C++ wrapper is chosen to be MPFR-C++ (http://www.holoborodko.com/pavel/mpfr/) since it is used in several other libraries, e.g. Eigen, boost::multiprecision. It can be used as a floating-point type in the Eigen linear algebra library and has much better support for std::numeric_limits
.
Since in the Dune GMPField
implementation, the precision is given by a template parameter, some numeric_limits
constants can be filled with concrete values.
The MPFR and MPFR-C++ library are available in the Ubuntu and Debian repositories (libmpfr-dev and libmpfrc++-dev).
-
Add packages for libmpfr and libmpfrc++ to docker images for the CI system.
Discussion
To allow a smooth transition time, the GMPField
type is still available, but deprecated. (Maybe we can just leave it in dune-common without deprecation). Step-by-step the use of GMP in downstream modules will be changed to MPFR. Once this is tested in downstream modules, we can make GMPField
and alias of MPFRField
and eventually remove that type.
Note
This MR is based on the old MR !565 (closed) that was done from a personal fork that cannot be used in connected multi-repo pipelines. Thus, the branch is uploaded now directly into the dune-common repository.