Mplapack
The MPLAPACK: multiple precision version of BLAS and LAPACK
Install / Use
/learn @nakatamaho/MplapackREADME
MPLAPACK — Multi-Precision Linear Algebra Package
MPLAPACK is a multi-precision linear algebra package based on BLAS and LAPACK, implemented in C++ (C++17 required). It supports a range of high-precision arithmetic libraries including GMP, MPFR, and QD, allowing users to select the backend that best suits their requirements. MPLAPACK is free software distributed under a 2-clause BSD-style license, supplemental to the original LAPACK license.
News
- 2026-03-05 MPLAPACK 2.1.0 released. C++17 now required. binary128/binary80 naming unified, MPFR emin/emax auto-adjustment, extended build matrix. LAPACK 3.9.1 Fortran sources are now mechanically converted to idiomatic C++ via Fable and bundled in the release tarball. See CHANGES.md and MIGRATION.md.
- 2022-09-12 MPLAPACK 2.0.1 released, featuring CUDA versions of Rgemm (dd) and Rsyrk (dd) for Volta and Ampere architectures (~450 GFlops on V100), and Windows DLLs for MinGW-w64.
- 2022-07-26 MPLAPACK 2.0.0 released. All routines (except mixed-precision) functional and tested across all supported precisions.
Capabilities
- MPBLAS: All BLAS routines in multiple-precision arithmetic.
- MPLAPACK: All LAPACK routines in multiple-precision arithmetic (except mixed-precision routines):
- Linear Equations
- Linear Least Squares (LLS) Problems
- Generalized Linear Least Squares (LSE and GLM) Problems
- Standard Eigenvalue and Singular Value Problems
- Symmetric Eigenproblems (SEP)
- Nonsymmetric Eigenproblems (NEP)
- Singular Value Decomposition (SVD)
- Generalized Eigenvalue and Singular Value Problems
- Generalized Symmetric Definite Eigenproblems (GSEP)
- Generalized Nonsymmetric Eigenproblems (GNEP)
- Generalized Singular Value Decomposition (GSVD)
Supported Precision Backends
- MPFR + MPC https://www.mpfr.org/ / http://www.multiprecision.org/mpc/ (arbitrary precision with IEEE-like rounding; primary backend)
- GMP https://gmplib.org/ (arbitrary precision)
- double (binary64)
- DD, QD https://www.davidhbailey.com/dhbsoftware/ (DD ≈ binary128, QD ≈ binary256)
- binary128 (IEEE 754-2018; compiler and platform support is complex — see binary128_binary80_type_support.md)
- binary80 (80-bit extended precision; Intel/AMD x86 only)
Compiler Support
| Compiler | binary128 | binary80 | |---|---|---| | GCC | ✅ Supported | ✅ (x86/x86_64 only) | | Intel oneAPI (icx/icpx) | ✅ Supported | ✅ (x86/x86_64 only) | | Clang/LLVM | ❌ Not supported | ✅ Supported |
Clang users:
binary128is not supported. Use GCC forbinary128.
Supported Platforms
| Tier | Guarantee | Platforms |
|---|---|---|
| Tier 1 | make distcheck + full test suite | macOS Intel Sonoma (amd64), Windows / MinGW-w64 (amd64), Ubuntu 22.04 (amd64), Ubuntu 24.04 (amd64) |
| Tier 2 | Build only | Debian 12/13 (amd64, arm64, i386, ppc64le, s390x, riscv64), Alpine Linux 3.19 (amd64, arm64), Rocky Linux 8/9 (amd64), Ubuntu 22.04/24.04 (arm64) |
| Tier 3 | Patches accepted; no CI coverage | Other platforms |
Tier 1/2 build scripts are in misc/:
misc/buildtest_tier1_amd64_macOS.sh
misc/buildtest_tier1_amd64_mingw64.sh
misc/buildtest_tier1_amd64_ubuntu.sh
misc/buildtest_tier2_arm64_ubuntu.sh
misc/buildtest_tier2_i386_debian.sh
How to Build and Install
Prerequisites
- GCC / G++ / GFortran (C++17 is required)
- Standard autotools:
autoconf,automake,libtool wgetorcurl(to fetch the tarball)
All third-party libraries (GMP, MPFR, MPC, QD, OpenBLAS, dlfcn-win32) are bundled and built automatically. No separate installation of these libraries is required.
Linux (amd64 / arm64)
mkdir -p $HOME/tmp && cd $HOME/tmp
wget https://github.com/nakatamaho/mplapack/releases/download/v2.1.0/mplapack-2.1.0.tar.xz
tar xvf mplapack-2.1.0.tar.xz
cd mplapack-2.1.0
export CXX=g++ CC=gcc FC=gfortran
./configure \
--prefix=$HOME/MPLAPACK \
--enable-gmp=yes \
--enable-mpfr=yes \
--enable-binary128=yes \
--enable-qd=yes \
--enable-dd=yes \
--enable-double=yes \
--enable-test=yes \
--enable-benchmark=yes
make -j$(nproc)
make install
To also enable binary80 (Intel/AMD x86 only), add --enable-binary80=yes:
./configure \
--prefix=$HOME/MPLAPACK \
--enable-binary80=yes \
--enable-binary128=yes \
--enable-gmp=yes \
--enable-mpfr=yes \
--enable-qd=yes \
--enable-dd=yes \
--enable-double=yes \
--enable-test=yes \
--enable-benchmark=yes
macOS (Intel; using MacPorts)
FSF GCC is required. The default Apple Clang does not support binary128.
sudo port install gcc14 coreutils git gsed
mkdir -p $HOME/tmp && cd $HOME/tmp
wget https://github.com/nakatamaho/mplapack/releases/download/v2.1.0/mplapack-2.1.0.tar.xz
tar xvf mplapack-2.1.0.tar.xz
cd mplapack-2.1.0
export CXX=g++-mp-14 CC=gcc-mp-14 FC=gfortran-mp-14
./configure \
--prefix=$HOME/MPLAPACK \
--enable-gmp=yes \
--enable-mpfr=yes \
--enable-binary128=yes \
--enable-binary80=yes \
--enable-qd=yes \
--enable-dd=yes \
--enable-double=yes \
--enable-test=yes \
--enable-benchmark=yes
make -j$(sysctl -n hw.logicalcpu)
make install
Windows (MinGW-w64 cross-compile on Ubuntu)
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 gfortran-mingw-w64-x86-64
mkdir -p $HOME/tmp && cd $HOME/tmp
wget https://github.com/nakatamaho/mplapack/releases/download/v2.1.0/mplapack-2.1.0.tar.xz
tar xvf mplapack-2.1.0.tar.xz
cd mplapack-2.1.0
export CXX=x86_64-w64-mingw32-g++
export CC=x86_64-w64-mingw32-gcc
export FC=x86_64-w64-mingw32-gfortran
./configure \
--host=x86_64-w64-mingw32 \
--prefix=$HOME/MPLAPACK \
--enable-gmp=yes \
--enable-mpfr=yes \
--enable-binary128=yes \
--enable-binary80=yes \
--enable-qd=yes \
--enable-dd=yes \
--enable-double=yes \
--enable-test=yes
make -j$(nproc)
make install
Verifying the Build
make check
Test results are summarized automatically by misc/summarize_mplapack_tests.py.
Fable — Fortran-to-C++ Conversion Pipeline
Note: The Fable conversion pipeline is not included in the release tarball. It is available only via Git clone. Regenerating sources also requires expanding the bundled LAPACK 3.9.1 source under
external/lapack/before running the scripts.
fable/ is a top-level standalone component providing automated Fortran-to-C++ conversion
of LAPACK 3.9.1 sources via Fable and FEM (Fortran Emulator).
# Step 1: clone the repository
git clone https://github.com/nakatamaho/mplapack
cd mplapack
# Step 2: expand bundled LAPACK sources
cd external/lapack
tar xvf lapack-3.9.1.tar.gz
cd ../..
# Step 3: run the conversion pipeline
bash fable/go.sh # library routines (BLAS/LAPACK C++ sources + headers + patches)
bash fable/go_testing.sh # test programs (EIG/LIN/MATGEN)
MPLAPACK Test Results
- https://github.com/nakatamaho/mplapack/tree/master/mplapack/test/lin/results
- https://github.com/nakatamaho/mplapack/tree/master/mplapack/test/eig/results
MPLAPACK Benchmark Results
- https://github.com/nakatamaho/mplapack/tree/master/benchmark/results/2022
Manual
- https://arxiv.org/abs/2109.13406v2
- https://raw.githubusercontent.com/nakatamaho/mplapack/master/doc/manual/manual.pdf
@misc{2109.13406v2,
Author = {Maho Nakata},
Title = {MPLAPACK version 2.0.1 user manual},
Year = {2022},
Eprint = {arXiv:2109.13406v2},
}
Movies
- https://www.youtube.com/watch?v=M76wHwckNPU (created by Ge Baolai)
Slides
- https://github.com/nakatamaho/mplapack/blob/master/doc/presentation/2023-06-01%20CMSI%E6%95%99%E8%82%B2%E8%A8%88%E7%AE%97%E7%A7%91%E5%AD%A6%E6%8A%80%E8%A1%93%E7%89%B9%E8%AB%96A%20%E7%AC%AC7%E5%9B%9E%20%E4%B8%AD%E7%94%B0%E7%9C%9F%E7%A7%80.pdf (in Japanese)
- https://github.com/nakatamaho/mplapack/blob/v2.0/doc/presentation/20211128_%E7%B2%BE%E5%BA%A6%E4%BF%9D%E8%A8%98meeting.pdf (in Japanese)
MPLAPACK Release Process
MPLAPACK 2.1.0 Release Process
Tier-S Representative Gate Matrix (Release Blockers)
Tier 1 platforms run the full pipeline including make distcheck. Tier 2 platforms run build only.
| # | Tier | OS | Arch | Compiler | binary80 | binary128 | Required tasks | Date |
|---:|:---:|:---|:---|:---|:---:|:---:|:---|:---|
| 1 | 1 | macOS Intel Sonoma | amd64 | GCC (MacPorts) | ✅ | ✅ | make distcheck + examples | - |
| 2 | 1 | Windows | amd64 | GCC (MinGW-w64) | ✅ | ✅ | make distcheck + examples | - |
| 3 | 1 | Ubuntu 22.04 | amd64 | GCC | ✅ | ✅ | make distcheck + examples | - |
| 4 | 1 | Ubuntu 24.04 | amd64 | GCC | ✅ | ✅ | make distcheck + examples | - |
| 5 | 2 | Ubuntu 24.04 | arm64 | GCC | N/A | ✅ | build only | - |
| 6 | 2 | Debian 12 | i386 | GCC | ✅ | N/A | build only | - |
| 7 | 2 | Rocky 8/9 | amd64 | GCC | ✅ | ✅ | build only | - |
| 8 | 2 | Alpine 3.19 | amd64, arm64 | GCC | ✅ | ✅ | build only | - |
| 9 | 2 | Debian 12 | ppc64le, s390x, riscv64 | GCC | N/A | ✅ | build only | - |
| 10 | 2 | Debian 13 | amd64 | GCC | ✅ | ✅ | build only | - |
Tier Policy
Tier 1 (release blockers):
make distcheckmust pass on all four Tier 1 platforms. Tier 2 (build guarantee): build only; not release-blocking. Tier 3 (patches accepted): no CI coverage.
CPU Architecture Tiers
| Tier | Architectures | Expectation |
|:---:|:---|:---|
| 1 | amd64 (macOS, Windows, Ubuntu) | make distcheck + examples |
| 2 | arm64, i386, ppc64le, s390x, riscv64 | build only |
| 3 | others | build-only best-effort |
Compiler Tiers
| Tier | Compilers | Expectation | |:---:|:---|:---| | 1 | GCC (native), GCC (MinGW-w64) | Must be green | | 2 | Clang | Build only; binary128 N/A | | — | Intel oneAPI | binary128 and binary80 broken (2024+); oneAPI 2023 worked but no longer readily available; https://github.com/nakatamaho/
