Solver for general full matrices (expert driver).
It solves the system of linear equations A * X = B with a full general matrix A. The matrix A is stored in a N x N block. The matrix B is stored in a N x NRHS block.
- Note
- There is a known bug in the
pgesvx solver that causes the program to hang. See details: https://github.com/Reference-ScaLAPACK/scalapack/issues/119
-
Enabling equilibration may cause the program to hang. Please check the status of the bug before setting
FACT to 'E'.
The example usage can be seen as follows.
#include <iomanip>
#include <iostream>
using namespace ezp;
int main() {
const auto& env = get_env<int_t>();
constexpr auto N = 6, NRHS = 2;
std::vector<double> A, B;
const auto IDX = par_dgesvx<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_dgesvx<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