33 #ifndef STRUMPACK_HODLR_MATRIX_HPP
34 #define STRUMPACK_HODLR_MATRIX_HPP
40 #include "dense/DistributedMatrix.hpp"
42 #include "sparse/CSRGraph.hpp"
55 std::unique_ptr<int[]> iwork;
56 int Ninter, Nallrows, Nallcols, Nalldat_loc,
57 *allrows, *allcols, *rowids, *colids, *pgids, Npmap, *pmaps;
85 using Vec_t = std::vector<std::size_t>;
86 using VecVec_t = std::vector<std::vector<std::size_t>>;
90 using real_t =
typename RealType<scalar_t>::value_type;
91 using mult_t =
typename std::function
93 using delem_blocks_t =
typename std::function
94 <void(VecVec_t& I, VecVec_t& J, std::vector<DistMW_t>& B,
96 using elem_blocks_t =
typename std::function
97 <void(VecVec_t& I, VecVec_t& J, std::vector<DenseMW_t>& B,
137 const std::function<scalar_t(
int i,
int j)>& Aelem,
162 const elem_blocks_t& Aelem,
const opts_t& opts);
215 template<
typename integer_t>
250 std::size_t
rows()
const override {
return rows_; }
255 std::size_t
cols()
const override {
return cols_; }
260 std::size_t
lrows()
const {
return lrows_; }
275 std::size_t
end_row()
const override {
return dist_[c_->
rank()+1]; }
282 const std::vector<int>&
dist()
const override {
return dist_; }
294 return get_stat(
"Mem_Fill") * 1024 * 1024;
298 return memory() /
sizeof(scalar_t);
316 return get_stat(
"Mem_Factor") * 1.e6;
516 void extract_elements(
const VecVec_t& I,
const VecVec_t& J,
517 std::vector<DistM_t>& B);
518 void extract_elements(
const VecVec_t& I,
const VecVec_t& J,
519 std::vector<DenseM_t>& B);
545 void set_sampling_parameter(
double sample_param);
546 void set_BACA_block(
int bsize);
560 const std::vector<int>&
perm()
const {
return perm_; }
565 const std::vector<int>&
iperm()
const {
return iperm_; }
568 F2Cptr ho_bf_ =
nullptr;
569 F2Cptr options_ =
nullptr;
570 F2Cptr stats_ =
nullptr;
571 F2Cptr msh_ =
nullptr;
572 F2Cptr kerquant_ =
nullptr;
573 F2Cptr ptree_ =
nullptr;
576 int rows_ = 0, cols_ = 0, lrows_ = 0, lvls_ = 0;
577 std::vector<int> perm_, iperm_;
578 std::vector<int> dist_;
579 std::vector<int> leafs_;
581 void options_init(
const opts_t& opts);
590 const typename HODLRMatrix<scalar_t>::delem_blocks_t* Aelem;
596 template<
typename scalar_t>
void HODLR_block_evaluation
597 (
int* Ninter,
int* Nallrows,
int* Nallcols,
int* Nalldat_loc,
598 int* allrows,
int* allcols, scalar_t* alldat_loc,
599 int* rowids,
int* colids,
int* pgids,
int* Npmap,
int* pmaps,
602 template<
typename scalar_t>
void HODLR_block_evaluation_seq
603 (
int* Ninter,
int* Nallrows,
int* Nallcols,
int* Nalldat_loc,
604 int* allrows,
int* allcols, scalar_t* alldat_loc,
605 int* rowids,
int* colids,
int* pgids,
int* Npmap,
int* pmaps,
Contains the class holding HODLR matrix options.
Definitions of several kernel functions, and helper routines. Also provides driver routines for kerne...
Contains the structured matrix interfaces.
This is a small wrapper class around a BLACS grid and a BLACS context.
Definition: BLACSGrid.hpp:66
Definition: CompressedSparseMatrix.hpp:56
Like DenseMatrix, this class represents a matrix, stored in column major format, to allow direct use ...
Definition: DenseMatrix.hpp:1015
This class represents a matrix, stored in column major format, to allow direct use of BLAS/LAPACK rou...
Definition: DenseMatrix.hpp:138
Definition: DistributedMatrix.hpp:289
Definition: DistributedMatrix.hpp:52
Butterfly matrix representation, this includes low-rank matrix representation as a special case.
Definition: ButterflyMatrix.hpp:63
Hierarchically low-rank matrix representation.
Definition: HODLRMatrix.hpp:79
long long int solve(const DistM_t &B, DistM_t &X) const
void extract_elements(const Vec_t &I, const Vec_t &J, DenseM_t &B)
HODLRMatrix(const MPIComm &c, const structured::ClusterTree &tree, const opts_t &opts)
void compress(const std::function< void(Trans op, const DenseM_t &R, DenseM_t &S)> &Amult)
DistM_t dense(const BLACSGrid *g) const
void mult(Trans op, const DistM_t &X, DistM_t &Y) const override
std::size_t total_memory() const
Definition: HODLRMatrix.hpp:305
long long int inv_mult(Trans op, const DenseM_t &B, DenseM_t &X) const
const std::vector< int > & dist() const override
Definition: HODLRMatrix.hpp:282
void compress(const std::function< void(Trans op, const DenseM_t &R, DenseM_t &S)> &Amult, int rank_guess)
std::size_t end_row() const override
Definition: HODLRMatrix.hpp:275
long long int solve(const DenseM_t &B, DenseM_t &X) const
const MPIComm & Comm() const
Definition: HODLRMatrix.hpp:287
double get_stat(const std::string &name) const
HODLRMatrix(HODLRMatrix< scalar_t > &&h)
Definition: HODLRMatrix.hpp:228
std::size_t rows() const override
Definition: HODLRMatrix.hpp:250
void solve(DistM_t &B) const override
const std::vector< int > & perm() const
Definition: HODLRMatrix.hpp:560
HODLRMatrix()
Definition: HODLRMatrix.hpp:103
HODLRMatrix< scalar_t > & operator=(const HODLRMatrix< scalar_t > &h)=delete
HODLRMatrix(const MPIComm &c, const structured::ClusterTree &tree, const std::function< scalar_t(int i, int j)> &Aelem, const opts_t &opts)
std::size_t begin_row() const override
Definition: HODLRMatrix.hpp:270
std::size_t lrows() const
Definition: HODLRMatrix.hpp:260
HODLRMatrix(const MPIComm &c, const structured::ClusterTree &tree, const CSRGraph< integer_t > &graph, const opts_t &opts)
std::size_t factor_memory() const
Definition: HODLRMatrix.hpp:315
HODLRMatrix(const HODLRMatrix< scalar_t > &h)=delete
HODLRMatrix(const MPIComm &c, const structured::ClusterTree &tree, const std::function< void(Trans op, const DenseM_t &R, DenseM_t &S)> &Amult, const opts_t &opts)
HODLRMatrix< scalar_t > & operator=(HODLRMatrix< scalar_t > &&h)
HODLRMatrix(const MPIComm &c, kernel::Kernel< real_t > &K, const opts_t &opts)
std::size_t cols() const override
Definition: HODLRMatrix.hpp:255
std::size_t total_factor_memory() const
Definition: HODLRMatrix.hpp:326
void mult(Trans op, const DenseM_t &X, DenseM_t &Y) const override
std::size_t local_rows() const override
Definition: HODLRMatrix.hpp:265
HODLRMatrix(const MPIComm &c, const structured::ClusterTree &tree, const elem_blocks_t &Aelem, const opts_t &opts)
std::size_t rank() const override
Definition: HODLRMatrix.hpp:333
void compress(const delem_blocks_t &Aelem)
std::size_t max_rank() const
Definition: HODLRMatrix.hpp:340
void compress(const elem_blocks_t &Aelem)
std::size_t memory() const override
Definition: HODLRMatrix.hpp:293
void solve(DenseM_t &B) const override
const std::vector< int > & iperm() const
Definition: HODLRMatrix.hpp:565
std::size_t nonzeros() const override
Definition: HODLRMatrix.hpp:297
Class containing several options for the HODLR code and data-structures.
Definition: HODLROptions.hpp:117
Wrapper class around an MPI_Comm object.
Definition: MPIWrapper.hpp:190
T all_reduce(T t, MPI_Op op) const
Definition: MPIWrapper.hpp:606
int rank() const
Definition: MPIWrapper.hpp:267
Representation of a kernel matrix.
Definition: Kernel.hpp:73
The cluster tree, or partition tree that represents the partitioning of the rows or columns of a hier...
Definition: ClusterTree.hpp:62
Class to represent a structured matrix. This is the abstract base class for several types of structur...
Definition: StructuredMatrix.hpp:209
Definition: StrumpackOptions.hpp:42
Trans
Definition: DenseMatrix.hpp:51
Definition: HODLRMatrix.hpp:589