LinAlgLib is a C++17 sparse linear algebra library focused on iterative methods, algebraic multigrid (AMG), and CPU/GPU execution backends.
- Sparse matrix and vector primitives (CSR-based workflows)
- Iterative solvers
- Classic: Jacobi, Gauss-Seidel, Symmetric Gauss-Seidel, Richardson, SOR, SSOR
- Krylov: CG, GMRES, BiCGSTAB
- AMG components
- Ruge-Stuben AMG
- Smoothed Aggregation AMG
- Unsmoothed Aggregation AMG
- Preconditioners (Jacobi, ILU/IC variants, and related methods)
- Optional CUDA backend for device execution
- Example applications and test clients
- Doxygen API documentation
library/
include/ # Public headers
src/ # Library implementation
clients/
examples/ # Example executables
testing/ # Test executable and test utilities
docs/
Doxyfile # Doxygen configuration
- CMake 3.25+
- C++17 compiler
- MSVC (Windows)
- GCC/Clang (Linux/macOS)
- Optional:
- CUDA Toolkit (for device backend)
- OpenMP
- MPI
Notes:
- The project auto-fetches some dependencies (for example GoogleTest and yaml-cpp in testing).
- CUDA is enabled by default when available (
ENABLE_CUDA=ON).
cd LinAlgLib
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debugcd LinAlgLib
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Releasecd LinAlgLib
cmake -S . -B build -DENABLE_CUDA=OFF
cmake --build build --config ReleaseExample targets are generated from files in clients/examples.
Common targets include:
jacobi_examplegmres_examplepcg_examplersamg_examplesaamg_exampleuaamg_example
Build an example target:
cmake --build build --config Release --target jacobi_exampleRun (Windows example path):
build/clients/examples/Release/jacobi_example.exeThe test executable target is test_main under clients/testing.
Build tests:
cmake --build build --config Debug --target test_mainRun (Windows example path):
build/clients/testing/Debug/test_main.execd LinAlgLib
doxygen docs/DoxyfileGenerated HTML docs are typically written to docs/html.
Example formatting command:
clang-format.exe -i --style microsoft library/src/iterative_solvers/amg/*.cpp- CMake configure fails:
- Delete
build/and reconfigure from scratch. - Verify CMake version and compiler are available in PATH.
- Delete
- CUDA expected but not enabled:
- Confirm CUDA Toolkit is installed and visible to CMake.
- Check configure output for
CMAKE_CUDA_COMPILERdetection messages.
- Host/device mismatch runtime errors:
- Ensure all solver inputs participating in a backend dispatch are on the same backend.
- Linker errors for templated CUDA helpers:
- Verify required explicit template instantiations exist in CUDA translation units.
This project is licensed under the MIT License. See LICENSE for details.