https://github.com/lkeegan/blockcg
Reference implementations of SBCGrQ and other Block Conjugate-Gradient iterative Krylov solvers in C++/Eigen
https://github.com/lkeegan/blockcg
block-solvers conjugate-gradient krylov-methods lattice-qcd rhmc
Last synced: about 1 year ago
JSON representation
Reference implementations of SBCGrQ and other Block Conjugate-Gradient iterative Krylov solvers in C++/Eigen
- Host: GitHub
- URL: https://github.com/lkeegan/blockcg
- Owner: lkeegan
- License: mit
- Created: 2018-05-18T18:18:37.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T10:42:53.000Z (over 7 years ago)
- Last Synced: 2025-02-01T08:31:09.477Z (over 1 year ago)
- Topics: block-solvers, conjugate-gradient, krylov-methods, lattice-qcd, rhmc
- Language: C++
- Homepage:
- Size: 1.74 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# blockCG [](https://travis-ci.org/lkeegan/blockCG) [](https://codecov.io/gh/lkeegan/blockCG)
Reference implementations of several Block Conjugate-Gradient iterative solvers in C++, including the SBCGrQ multi-shift block CG solver used in [http://arxiv.org/abs/1808.01829](http://arxiv.org/abs/1808.01829). The block solvers are implemented in [inc/block_solvers.hpp](inc/block_solvers.hpp), with some simple examples of their use in [test/solvers.cpp](test/solvers.cpp) and [benchmark.cpp](benchmark.cpp).
Block solvers are a variant of iterative Krylov solvers that act on multiple RHS vectors, and can converge significantly faster than standard solvers. For more details of the solvers implemented here, along with references to the original formulations, see the [documentation](doc/blockCG.pdf).
This code uses the [Eigen](http://eigen.tuxfamily.org) C++ template library for the small dense matrix operations, and the [Catch2](https://github.com/catchorg/Catch2) test framework, both included.
## Implemented solvers
Block | Multishift Block | Standard
--------- | ---------------- | --------
BCG | SBCGrQ | CG
BCGrQ | | SCG
## Use
To compile and run the tests in debug mode to check everything is working:
```
mkdir Debug
cd Debug
cmake .. -DCMAKE_BUILD_TYPE=Debug
make tests
```
To compile and run the example benchmark code that compares the SCG and SBCGrQ solvers:
```
mkdir Release
cd Release
cmake .. -DCMAKE_BUILD_TYPE=Release
make benchmark
./benchmark 1e3 1e-3 1e-10
```
where
- 1e3 is the "lattice volume": proportional to the size of the sparse matrix
- 1e-3 is the "mass": inversely related to the condition number of the matrix
- 1e-10 is the stopping criterion for the relative residual.