Skip to content

MTL5 — Matrix Template Library

A modern C++20 successor to MTL4 — header-only linear algebra with concepts, expression templates, and first-class support for custom number types.

Pure C++20

Concepts, if constexpr, std::span, ranges — zero Boost dependencies.

Header-Only

Just #include and go. No linking, no build-system gymnastics.

Mixed Precision

Designed for custom arithmetic types — posits, LNS, cfloats, and more via the Universal library.

Dense & Sparse

CSR, COO, ELLPACK, dense row/column-major matrices with expression templates.

Iterative Solvers

CG, BiCGSTAB, GMRES, IDR(s), and more — with preconditioners, smoothers, and multigrid.

Direct Solvers

Dense LU / Cholesky / LDLᵀ / QR / SVD and sparse KLU / SuperLU, LAPACK-dispatched.

The library’s internals are documented layer by layer — how each piece works, and why it is shaped that way. Start with a data structure, or trace the path from an expression down to the kernel that runs it.

MTL5 itself never depends on Universal. The studies that run its algorithms in Universal’s number types, and measure where each type stops being usable, are published by mp-numerics.