Commit b560f19
authored
Add preconditioning to the ALP CG solvers (#309)
This MR resolves a feature request for a preconditioned CG accessible via a transition path. To enable this feature, this MR adds the following:
- standard left-sided preconditioning to the ALP CG has been added. There are now two entry points `grb::algorithms::conjugate_gradient` for non-preconditioned CG, and `grb::algorithms::preconditioned_conjugate_gradient` for PCG. They are kept separate since PCG requires one more work-space vector. The preconditioner is given as an `std::function` that returns a `grb::RC`, takes an output `grb::Vector` and an input `const grb::Vector`. Given it's an `std::function`, any state required by the preconditioner can be embedded into the function (there is no additional argument required for this).
- the sparse solver transition path API now can take preconditioners also. Since this is a C API, the preconditioner is given as a function pointer. The return type is an `int` where `0` indicates successful application of the preconditioner. The first argument is a raw output vector, the second a const input vector, and the third a `void *` argument to any state required by the preconditioner.
- the kml_iss.h transition path API now also takes preconditioners, given as a function pointer with signature according to the current KML solver specification.
The MR also expands and improves documentation regarding the transition path libraries.
This MR adds the following smoke test:
- preconditioned CG with simple Jacobi preconditioning, both for real (`double`) and the complex case. Note that for the complex case, Jacobi preconditioning may not be a good choice; it is not encouraged to use outside of smoke testing.
To enable the smoke tests, this MR additionally includes the following bugfixes:
- the vector-to-vector foldr was not implemented in the BSP1D and hybrid backends, herewith fixed;
- the eWiseLambda(vector) for BSP1D and hybrid was using local indexing, while it should have been global;
- a meta-bug in the distributed implementation of `grb::set(BSP1D,hybrid)` erroneously relied on local indexing of eWiseLambda.
As always and additionally, the MR include code style fixes in both related and unrelated files.1 parent 8c20fb6 commit b560f19
File tree
31 files changed
+2771
-914
lines changed- include
- graphblas
- algorithms
- base
- bsp1d
- hyperdags
- nonblocking
- reference
- utils
- transition
- src/transition
- tests/smoke
31 files changed
+2771
-914
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 41 | | |
47 | 42 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
51 | 71 | | |
52 | 72 | | |
53 | 73 | | |
| |||
0 commit comments