C++23 numerical routines for dense and structured linear algebra, ODE/PDE integration, Fourier transforms, quadrature, statistics, Monte Carlo sampling, and particle geometry.
The package is a solver suite. Operators provide a common argument form for Krylov and action routines, but the library also includes direct solvers, eigenvalue routines, SVD, FFTs, finite-difference routines, stochastic kernels, and optional BLAS/LAPACK/LAPACKE, FFTW3, OpenMP, CUDA, and MPI backends.
Examples
Implementation Notes
Dense Linear Algebra
A(0, 0) = 4.0; A(0, 1) = 1.0;
A(1, 0) = 1.0; A(1, 1) = 3.0;
void lu_solve(const LUResult &f, const Vector &b, Vector &x)
Solve from a precomputed factorization.
LUResult lu(const Matrix &A, Backend backend=lapack_backend)
Umbrella include for the numerics library.
Iterative Solvers
SolverResult cg(const Matrix &A, const Vector &b, Vector &x, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
Adapt a dense Matrix to the operator protocol.
Matrix-Free Operators
apply_negative_laplacian(u, Lu, N);
},
N * N);
CallableOp< F > make_op(F f, idx rows, idx cols)
SolverResult gmres(const Op &A, const Vector &b, Vector &x, real tol=1e-6, idx max_iter=1000, idx restart=30)
Operator GMRES for any adapter.
ODE Integration
dy[0] = y[1];
dy[1] = -y[0];
};
ODEResult solve(const P &prob, const RK45 &alg, ObserverFn obs=nullptr)
Build
cmake -B build -DNUMERICS_BUILD_TESTS=ON
cmake --build build -j$(nproc)
ctest --test-dir build --output-on-failure
CMake Use
find_package(numerics REQUIRED)
target_link_libraries(my_program PRIVATE numerics::numerics)