Butterfly matrix representation, this includes low-rank matrix representation as a special case. More...
#include <ButterflyMatrix.hpp>
Public Types | |
using | mult_t = typename std::function< void(Trans, scalar_t, const DenseM_t &, scalar_t, DenseM_t &)> |
using | delem_blocks_t = typename HODLRMatrix< scalar_t >::delem_blocks_t |
using | elem_blocks_t = typename HODLRMatrix< scalar_t >::elem_blocks_t |
Public Member Functions | |
ButterflyMatrix (const MPIComm &comm, const structured::ClusterTree &row_tree, const structured::ClusterTree &col_tree, const opts_t &opts) | |
ButterflyMatrix (const HODLRMatrix< scalar_t > &A, const HODLRMatrix< scalar_t > &B) | |
ButterflyMatrix (const HODLRMatrix< scalar_t > &A, const HODLRMatrix< scalar_t > &B, DenseMatrix< int > &neighbors_rows, DenseMatrix< int > &neighbors_cols, const opts_t &opts) | |
ButterflyMatrix (const ButterflyMatrix< scalar_t > &h)=delete | |
ButterflyMatrix (ButterflyMatrix< scalar_t > &&h) | |
ButterflyMatrix< scalar_t > & | operator= (const ButterflyMatrix< scalar_t > &h)=delete |
ButterflyMatrix< scalar_t > & | operator= (ButterflyMatrix< scalar_t > &&h) |
std::size_t | rows () const override |
std::size_t | cols () const override |
std::size_t | lrows () const |
std::size_t | local_rows () const override |
std::size_t | lcols () const |
std::size_t | begin_row () const override |
std::size_t | end_row () const override |
const std::vector< int > & | rdist () const override |
std::size_t | begin_col () const |
std::size_t | end_col () const |
const std::vector< int > & | cdist () const override |
const MPIComm & | Comm () const |
std::size_t | memory () const override |
std::size_t | nonzeros () const override |
std::size_t | rank () const override |
void | compress (const mult_t &Amult) |
void | compress (const mult_t &Amult, int rank_guess) |
void | compress (const delem_blocks_t &Aelem) |
void | compress (const elem_blocks_t &Aelem) |
void | mult (Trans op, const DenseM_t &X, DenseM_t &Y) const override |
void | mult (Trans op, const DistM_t &X, DistM_t &Y) const override |
void | extract_add_elements (const VecVec_t &I, const VecVec_t &J, std::vector< DenseMW_t > &B) |
void | extract_add_elements (ExtractionMeta &e, std::vector< DistMW_t > &B) |
void | extract_add_elements (ExtractionMeta &e, std::vector< DenseMW_t > &B) |
double | get_stat (const std::string &name) const |
void | print_stats () |
void | set_sampling_parameter (double sample_param) |
void | set_BACA_block (int bsize) |
DistM_t | dense (const BLACSGrid *g) const |
DenseM_t | redistribute_2D_to_1D (const DistM_t &R2D, const std::vector< int > &dist) const |
void | redistribute_2D_to_1D (scalar_t a, const DistM_t &R2D, scalar_t b, DenseM_t &R1D, const std::vector< int > &dist) const |
void | redistribute_1D_to_2D (const DenseM_t &S1D, DistM_t &S2D, const std::vector< int > &dist) const |
Public Member Functions inherited from strumpack::structured::StructuredMatrix< scalar_t > | |
virtual | ~StructuredMatrix ()=default |
virtual std::size_t | rows () const =0 |
virtual std::size_t | cols () const =0 |
virtual std::size_t | memory () const =0 |
virtual std::size_t | nonzeros () const =0 |
virtual std::size_t | rank () const =0 |
virtual std::size_t | local_rows () const |
virtual std::size_t | begin_row () const |
virtual std::size_t | end_row () const |
virtual const std::vector< int > & | dist () const |
virtual const std::vector< int > & | rdist () const |
virtual const std::vector< int > & | cdist () const |
virtual void | mult (Trans op, const DenseMatrix< scalar_t > &x, DenseMatrix< scalar_t > &y) const |
void | mult (Trans op, int m, const scalar_t *x, int ldx, scalar_t *y, int ldy) const |
virtual void | mult (Trans op, const DistributedMatrix< scalar_t > &x, DistributedMatrix< scalar_t > &y) const |
virtual void | factor () |
virtual void | solve (DenseMatrix< scalar_t > &b) const |
virtual void | solve (int nrhs, scalar_t *b, int ldb) const |
virtual void | solve (DistributedMatrix< scalar_t > &b) const |
virtual void | shift (scalar_t s) |
Butterfly matrix representation, this includes low-rank matrix representation as a special case.
This requires MPI support.
There are 2 different ways to create a ButterflyMatrix
scalar_t | Can be double, or std::complex<double>. |
strumpack::HODLR::ButterflyMatrix< scalar_t >::ButterflyMatrix | ( | const HODLRMatrix< scalar_t > & | A, |
const HODLRMatrix< scalar_t > & | B | ||
) |
Construct the block X, subblock of the matrix [A X; Y B] A and B should be defined on the same MPI communicator.
|
inlineoverridevirtual |
For a distributed matrix, which uses a block row distribution, this gives the first rows stored on this process.
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
For a distributed rectangular matrix, return the 1D block columns distribution.
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
Get number of columns in this matrix
Implements strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
For a distributed matrix, which uses a block row distribution, this gives the final row (+1) stored on this process.
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
For a distributed matrix, which uses a block row distribution, this gives the number of rows stored on this process.
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
Return the total amount of memory used by this matrix, in bytes.
Implements strumpack::structured::StructuredMatrix< scalar_t >.
|
overridevirtual |
Multiply the StructuredMatrix (A) with a dense matrix: y = op(A)*x.
op | take transpose/conjugate or not |
x | matrix, x.rows() == op(A).cols() |
y | matrix, y.cols() == x.cols(), y.rows() == A.rows() |
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
overridevirtual |
Multiply this low-rank (or butterfly) matrix with a dense matrix: Y = op(A) * X, where op can be none, transpose or complex conjugate. X and Y are in 2D block cyclic distribution.
op | Transpose, conjugate, or none. |
X | Right-hand side matrix. Should be X.rows() == this.rows(). |
Y | Result, should be Y.cols() == X.cols(), Y.rows() == this.rows() |
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
Return the total number of nonzeros stored by this matrix.
Implements strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
Return the maximum rank of this matrix over all low-rank compressed blocks.
Implements strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
For a distributed rectangular matrix, return the 1D block row distribution.
Reimplemented from strumpack::structured::StructuredMatrix< scalar_t >.
|
inlineoverridevirtual |
Get number of rows in this matrix
Implements strumpack::structured::StructuredMatrix< scalar_t >.