Solver for general full symmetric positive definite matrices (expert driver).
More...
Solver for general full symmetric positive definite matrices (expert driver).
It solves the system of linear equations A * X = B with a full symmetric positive definite matrix A. The matrix A is stored in a N x N block. The matrix B is stored in a N x NRHS block.
The example usage can be seen as follows.
#include <iomanip>
#include <iostream>
using namespace ezp;
int main() {
const auto& env = get_env<>();
constexpr auto N = 6, NRHS = 2;
std::vector<double> A, B;
const auto IDX = par_dposvx<int_t>::indexer{N};
if(0 == env.rank()) {
A.resize(N * N, 0.);
B.resize(N * NRHS);
static constexpr auto M = 5.10156648;
for(auto I = 0; I < N; ++I) {
B[I] = A[IDX(I, I)] = I + 1;
B[N + I] = (I + 1) * M;
}
}
auto solver = par_dposvx<int_t>();
const auto info = solver.solve({N, N, A.data()}, {N, NRHS, B.data()});
if(0 == env.rank() && 0 == info) {
std::cout << std::setprecision(10) << "Info: " << info << '\n';
std::cout << "Solution:\n";
for(const double i : B) std::cout << i << '\n';
}
return info;
}
- Author
- tlc
- Date
- 12/03/2025
- Version
- 1.0.0