Gitter Build status codecov

-> Get it: here!

What is this?

The Gmp Eigen Matrix Library is an open source solution for high precision numerical computation in Matlab and GNU Octave1.

The library implements two data types:

  • gem : high precision dense matrices
  • sgem : high precision sparse matrices

… and overloads a number of Matlab/Octave functions. The full library can be downloaded here.

Why the GEM Library?

Few solutions out there allow working seemlessly with high precision numbers and matrices. In particular, two common shortcomings, including for Matlab’s own VPA class, are:

  • Exagerated slowness
  • No support for sparse matrices

The GEM Library attempts to mitigates these points, thereby providing a basis for easy high precision numerical computation.

Related open source libraries include:

What does it look like?

  • On Matlab/Octave, the command sin(pi) returns 1.2246e-16 because computations are limited to machine precision. With the GEM Library, sin(gem('pi')) returns 4.3348e-51, a value compatible with the default working precision of 50 digits.

  • Matrix operations such as eigenvalue decompositions are automatically computed in high precision. For instance, eig(gem([1 1; 1 -1])) computes the eigenvalues of a 2x2 integer matrix. The result includes a high precision decimal expansion of sqrt(2).

See the example page for some usage illustrations.

How to start using the GEM Library

See the installation guide.

Documentation

Check the tutorial.

Contributors

The C++ and Matlab/Octave code of the GEM Library was written by Jean-Daniel Bancal.

The library currently relies on:

  • GMP for high precision arithmetic (through MPFR, and MPFR C++ by Pavel Holoborodko)
  • Eigen, and Spectra by Yixuan Qiu for matrix manipulations
  • MOxUnit and MOcov by Nikolaas N. Oosterhof for testing and code coverage monitoring

Feedback an suggestions are welcome. Contributions are also welcome through the github page (see how to contribute). We ask participants to follow the guidelines of the Typelevel Code of Conduct.

License

The GEM Library is an open source project. It can be use freely, including for academic use and proprietary applications (with some obligations). The source code is distributed under the MPL2 license (more details). It comes with no guarantee.


Background Photo by Andrea Sonda on Unsplash

  1. Thanks to the Octave team for their effort in significantly improving the support for classdefs in Octave 6