18 #ifndef FULL_SOLVER_HPP
19 #define FULL_SOLVER_HPP
21 #include "abstract_solver.hpp"
23 namespace ezp::detail {
28 IT n{-1}, block{-1}, rows{-1}, cols{-1};
39 auto init_storage(
const IT n) {
41 loc.block = std::max(IT{1},
static_cast<IT
>(std::sqrt(ctx.
row_block(loc.n) * ctx.
col_block(loc.n))));
42 loc.rows = ctx.
rows(loc.n, loc.block);
43 loc.cols = ctx.
cols(loc.n, loc.block);
44 loc.desc_a = ctx.
desc_l(loc.n, loc.n, loc.block, loc.rows);
46 loc.a.resize(loc.rows * loc.cols);
47 loc.ipiv.resize(loc.rows + loc.block);
51 const auto ipiv_l = ctx.
desc_l(loc.n, 1, loc.block, loc.rows);
52 const auto ipiv_g = ctx.
desc_g(loc.n, 1);
55 if(0 == ctx.rank) ipiv.resize(loc.n);
57 ctx.copy_to(loc.ipiv.data(), ipiv_l.data(), ipiv.data(), ipiv_g.data());
62 using base_t::to_full;
71 , ctx(rows, cols, ODER) {}
88 auto operator()(
const IT i,
const IT j)
const {
89 if(i < 0 || i >= n || j < 0 || j >= n)
return IT{-1};
96 template<full_container_t AT, full_container_t BT> IT solve(AT&& A, BT&& B) {
return solve(to_full(std::forward<AT>(A)), to_full(std::forward<BT>(B))); }
97 template<full_container_t AT> IT solve(AT&& A,
full_mat<DT, IT>&& B) {
return solve(to_full(std::forward<AT>(A)), std::move(B)); }
98 template<full_container_t BT> IT solve(
full_mat<DT, IT>&& A, BT&& B) {
return solve(std::move(A), to_full(std::forward<BT>(B))); }
Definition: traits.hpp:176
auto desc_l(const IT num_rows, const IT num_cols, const IT row_block, const IT col_block, const IT lead)
Generates a descriptor for a local matrix.
Definition: traits.hpp:297
auto rows(const IT n, const IT nb) const
Computes the number of local rows of the current process.
Definition: traits.hpp:344
auto col_block(const IT n) const
Computes the column block size.
Definition: traits.hpp:332
auto row_block(const IT n) const
Computes the row block size.
Definition: traits.hpp:327
auto cols(const IT n, const IT nb) const
Computes the number of local columns of the current process.
Definition: traits.hpp:356
auto desc_g(const IT num_rows, const IT num_cols)
Generates a descriptor for a global matrix.
Definition: traits.hpp:275
Definition: abstract_solver.hpp:24
Definition: full_solver.hpp:73
Definition: full_solver.hpp:24
Definition: traits.hpp:85