Solver for general sparse matrices.
It solves the system of linear equations A * X = B with a general sparse matrix A. The RHS matrix B is a dense matrix.
The matrix A should be stored in the Compressed Sparse Row (CSR) format with one-based indexing. Use the call operator to set the parameters iparm for the solver.
The example usage can be seen as follows.
#include <iomanip>
#include <iostream>
int main() {
#ifdef EZP_MKL
const auto& comm_world{mpl::environment::comm_world()};
auto solver = ezp::pardiso<double, int_t>(ezp::matrix_type::real_and_nonsymmetric, ezp::message_level::no_output);
int N = 10, NRHS = 1;
std::vector<int_t>
ia,
ja;
std::vector<double> a, b;
if(0 != comm_world.rank()) return;
a.resize(N);
b.resize(N * NRHS);
ia[N] =
static_cast<int_t
>(N + 1);
std::ranges::fill(b, 1.);
};
auto info = solver.solve({N, N,
ia.data(),
ja.data(), a.data()}, {N, NRHS, b.data()});
if(0 != comm_world.rank()) return;
std::cout << std::fixed << std::setprecision(10) << "Info: " << info << '\n';
std::cout << "Solution:\n";
for(
const auto i : b)
std::
cout <<
i <<
'\n';
};
N = 20;
info = solver.solve({N, N,
ia.data(),
ja.data(), a.data()}, {N, NRHS, b.data()});
return info;
#else
std::cerr << "MKL not enabled.\n";
return 0;
#endif
}
Solver for general sparse matrices.
- Author
- tlc
- Date
- 23/03/2025
- Version
- 1.0.0