Class to represent a structured matrix. This is the abstract base class for several types of structured matrices. More...
#include <StructuredMatrix.hpp>
Public Member Functions | |
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) |
Class to represent a structured matrix. This is the abstract base class for several types of structured matrices.
scalar_t | Can be float, double, std::complex<float> or std::complex<double>. Some formats do not support all precisions, see the table below. |
For construction, use one of:
However, not all formats support all construction methods, matrix operations, or precisions (s: float, d: double, c: std::complex<float>, z: std::complex<double>):
parallel? | construct from .. | operation | precision | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
seq | MPI | DENSE | ELEM | MF | PMF | NN | mult | factor | solve | shift | s | d | c | z | |
BLR | X | X | X | X | X | X | X | ? | X | X | X | X | |||
HSS | X | X | X | X | X | X | X | X | X | X | X | X | X | ||
HODLR | X | X | X | X | X | X | X | X | ? | X | X | ||||
HODBF | X | X | X | X | X | X | X | X | ? | X | X | ||||
BUTTERFLY | X | X | X | X | X | X | X | X | |||||||
LR | X | X | X | X | X | X | X | X | |||||||
LOSSY | X | X | X | X | X | X | |||||||||
LOSSLESS | X | X | X | X | X | X |
|
virtualdefault |
Virtual destructor.
|
inlinevirtual |
For a distributed matrix, which uses a block row distribution, this gives the first rows stored on this process.
Reimplemented in strumpack::HODLR::HODLRMatrix< scalar_t >, and strumpack::HODLR::ButterflyMatrix< scalar_t >.
|
inlinevirtual |
For a distributed rectangular matrix, return the 1D block columns distribution.
Reimplemented in strumpack::HODLR::ButterflyMatrix< scalar_t >.
|
pure virtual |
Get number of columns in this matrix
Implemented in strumpack::HSS::HSSMatrixBase< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, strumpack::HODLR::ButterflyMatrix< scalar_t >, strumpack::BLR::BLRMatrixMPI< scalar_t >, and strumpack::BLR::BLRMatrix< scalar_t >.
|
inlinevirtual |
For a distributed matrix, return the 1D block row distribution over processes. This is for square matrices, for rectagular use rdist for the rows and cdist for the columns.
Reimplemented in strumpack::HODLR::HODLRMatrix< scalar_t >.
|
inlinevirtual |
For a distributed matrix, which uses a block row distribution, this gives the final row (+1) stored on this process.
Reimplemented in strumpack::HODLR::HODLRMatrix< scalar_t >, and strumpack::HODLR::ButterflyMatrix< scalar_t >.
|
virtual |
Compute a factorization (or the inverse) of this matrix, to be used later for solving linear systems. The actual type of factorization depends on the StructuredMatrix::Type of this matrix.
Reimplemented in strumpack::HSS::HSSMatrixMPI< scalar_t >, strumpack::HSS::HSSMatrix< scalar_t >, and strumpack::HODLR::HODLRMatrix< scalar_t >.
|
inlinevirtual |
For a distributed matrix, which uses a block row distribution, this gives the number of rows stored on this process.
Reimplemented in strumpack::HODLR::HODLRMatrix< scalar_t >, and strumpack::HODLR::ButterflyMatrix< scalar_t >.
|
pure virtual |
Return the total amount of memory used by this matrix, in bytes.
Implemented in strumpack::HSS::HSSMatrixMPI< scalar_t >, strumpack::HSS::HSSMatrix< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, strumpack::HODLR::ButterflyMatrix< scalar_t >, strumpack::BLR::BLRMatrixMPI< scalar_t >, and strumpack::BLR::BLRMatrix< scalar_t >.
|
virtual |
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 in strumpack::HSS::HSSMatrix< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, strumpack::HODLR::ButterflyMatrix< scalar_t >, and strumpack::BLR::BLRMatrix< scalar_t >.
|
virtual |
Multiply the StructuredMatrix (A) with a dense matrix: y = op(A)*x. x and y are 2d block cyclic.
op | take transpose/conjugate or not |
x | matrix, x.rows() == op(A).cols() |
y | matrix, y.cols() == x.cols(), y.rows() == A.rows() |
Reimplemented in strumpack::HSS::HSSMatrixMPI< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, and strumpack::HODLR::ButterflyMatrix< scalar_t >.
void strumpack::structured::StructuredMatrix< scalar_t >::mult | ( | Trans | op, |
int | m, | ||
const scalar_t * | x, | ||
int | ldx, | ||
scalar_t * | y, | ||
int | ldy | ||
) | const |
Multiply the StructuredMatrix (A) with a dense matrix: y = op(A)*x.
op | take transpose/conjugate or not |
m | columns in x and y |
x | matrix, x should have rows == op(A).cols() |
ldx | leading dimension of x |
y | matrix, y should have cols == x.cols(), and rows == A.rows() |
ldy | leading dimension of y |
|
pure virtual |
Return the total number of nonzeros stored by this matrix.
Implemented in strumpack::HSS::HSSMatrixMPI< scalar_t >, strumpack::HSS::HSSMatrix< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, strumpack::HODLR::ButterflyMatrix< scalar_t >, strumpack::BLR::BLRMatrixMPI< scalar_t >, and strumpack::BLR::BLRMatrix< scalar_t >.
|
pure virtual |
Return the maximum rank of this matrix over all low-rank compressed blocks.
Implemented in strumpack::HSS::HSSMatrixMPI< scalar_t >, strumpack::HSS::HSSMatrix< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, strumpack::HODLR::ButterflyMatrix< scalar_t >, strumpack::BLR::BLRMatrixMPI< scalar_t >, and strumpack::BLR::BLRMatrix< scalar_t >.
|
inlinevirtual |
For a distributed rectangular matrix, return the 1D block row distribution.
Reimplemented in strumpack::HODLR::ButterflyMatrix< scalar_t >.
|
pure virtual |
Get number of rows in this matrix
Implemented in strumpack::HSS::HSSMatrixBase< scalar_t >, strumpack::HODLR::HODLRMatrix< scalar_t >, strumpack::HODLR::ButterflyMatrix< scalar_t >, strumpack::BLR::BLRMatrixMPI< scalar_t >, and strumpack::BLR::BLRMatrix< scalar_t >.
|
virtual |
Apply a shift to the diagonal of this matrix. Ie, this += s*I, with I the identity matrix. If this is called after calling factor, then the factors are not updated. To solve a linear system with the shifted matrix, you need to call factor again.
s | Shift to be applied to the diagonal. |
Reimplemented in strumpack::HSS::HSSMatrixBase< scalar_t >, strumpack::HSS::HSSMatrixMPI< scalar_t >, and strumpack::HSS::HSSMatrix< scalar_t >.
|
virtual |
Solve a linear system A*x=b, with this StructuredMatrix (A). This solve is done in-place.
b | right-hand side, b.rows() == A.cols(), will be overwritten with the solution x. |
Reimplemented in strumpack::HSS::HSSMatrix< scalar_t >, and strumpack::HODLR::HODLRMatrix< scalar_t >.
|
virtual |
Solve a linear system A*x=b, with this StructuredMatrix (A). This solve is done in-place.
b | right-hand side, b.rows() == A.cols(), will be overwritten with the solution x. |
Reimplemented in strumpack::HSS::HSSMatrixMPI< scalar_t >, and strumpack::HODLR::HODLRMatrix< scalar_t >.
|
inlinevirtual |
Solve a linear system A*x=b, with this StructuredMatrix (A). This solve is done in-place.
nrhs | number of right-hand sides |
b | right-hand side, should have this->cols() rows, will be overwritten with the solution x. |
ldb | leading dimension of b |