38#include "abstract/sparse_solver.hpp"
120 LIS_SCALAR** v_value;
135 LIS_INT* import_index;
137 LIS_INT* export_index;
196 LIS_INT is_fallocated;
208 LIS_SCALAR** w_value;
209 LIS_SCALAR*** v_value;
225 LIS_SCALAR*** values;
284LIS_INT lis_finalize(
void);
285LIS_INT lis_initialize(
int*
argc,
char**
argv[]);
289LIS_INT lis_matrix_set_csr(LIS_INT nnz, LIS_INT* row, LIS_INT* index,
LIS_SCALAR* value,
LIS_MATRIX A);
295LIS_INT lis_solver_set_option(
const char*
text,
LIS_SOLVER solver);
301void lis_do_not_handle_mpi();
307 const mpl::communicator& comm_world{mpl::environment::comm_world()};
310 lis_do_not_handle_mpi();
311 lis_initialize(
nullptr,
nullptr);
315 [[
nodiscard]]
auto rank()
const {
return comm_world.rank(); }
317 [[
nodiscard]]
auto native_handle()
const {
return comm_world.native_handle(); }
320 inline auto& get_lis_env() {
331 if(is_set) lis_matrix_unset(a_mat);
332 lis_matrix_destroy(a_mat);
336 auto create() {
return lis_matrix_create(get_lis_env().native_handle(), &a_mat); }
351 [[
nodiscard]]
auto get()
const {
return a_mat; }
356 const bool is_root = 0 == get_lis_env().rank();
357 lis_matrix_set_size(a_mat,
is_root ? A.n : 0, 0);
358 lis_matrix_set_csr(
is_root ? A.nnz : 0, A.row_ptr, A.col_idx, A.data, a_mat);
359 lis_matrix_assemble(a_mat);
370 if(is_set) lis_vector_unset(v);
376 lis_vector_create(get_lis_env().native_handle(), &v);
377 if(n > 0) lis_vector_set_size(v, 0 == get_lis_env().rank() ? n : 0, 0);
387 lis_vector_destroy(v);
390 [[
nodiscard]]
auto get()
const {
return v; }
395 lis_vector_set(v, 0 == get_lis_env().rank() ? value :
nullptr);
417 void set_option(
const std::string_view
setting)
const { lis_solver_set_option(
setting.data(), solver); }
427 env.comm_world.allreduce(mpl::min<LIS_INT>(),
error);
446 void set_option(
const std::string_view
setting)
const { solver.set_option(
setting); }
449 a_loc.set(std::move(A));
451 return solve(std::move(
B));
455 if(a_loc.get()->gn !=
B.n_rows)
return -1;
459 std::vector<LIS_SCALAR>
b_ref;
460 if(0 == env.rank()) {
461 b_ref.resize(
B.n_rows *
B.n_cols);
467 for(
decltype(
B.n_rows)
I = 0;
I <
B.n_rows *
B.n_cols;
I +=
B.n_rows) {
470 if(0 !=
error)
break;
Solver for general sparse matrices.