32 #ifndef STRUCTURED_MATRIX_HPP
33 #define STRUCTURED_MATRIX_HPP
44 #if defined(STRUMPACK_USE_MPI)
45 #include "dense/DistributedMatrix.hpp"
55 namespace structured {
66 template<
typename scalar_t>
68 <scalar_t(std::size_t i, std::size_t j)>;
79 template<
typename scalar_t>
81 <void(
const std::vector<std::size_t>& I,
82 const std::vector<std::size_t>& J,
97 template<
typename scalar_t>
103 #if defined(STRUMPACK_USE_MPI)
115 template<
typename scalar_t>
117 <void(
const std::vector<std::size_t>& I,
118 const std::vector<std::size_t>& J,
133 template<
typename scalar_t>
157 template<
typename scalar_t>
162 const std::vector<int>& rdist,
163 const std::vector<int>& cdist)>;
210 using real_t =
typename RealType<scalar_t>::value_type;
222 virtual std::size_t
rows()
const = 0;
227 virtual std::size_t
cols()
const = 0;
252 virtual std::size_t
rank()
const = 0;
263 throw std::invalid_argument
264 (
"1d block row distribution not supported for this format.");
275 throw std::invalid_argument
276 (
"1d block row distribution not supported for this format.");
287 throw std::invalid_argument
288 (
"1d block row distribution not supported for this format.");
299 virtual const std::vector<int>&
dist()
const {
300 static std::vector<int> d = {0, int(
rows())};
310 virtual const std::vector<int>&
rdist()
const {
320 virtual const std::vector<int>&
cdist()
const {
348 scalar_t* y,
int ldy)
const;
350 #if defined(STRUMPACK_USE_MPI)
389 virtual void solve(
int nrhs, scalar_t* b,
int ldb)
const {
397 #if defined(STRUMPACK_USE_MPI)
459 template<
typename scalar_t>
460 std::unique_ptr<StructuredMatrix<scalar_t>>
506 template<
typename scalar_t>
507 std::unique_ptr<StructuredMatrix<scalar_t>>
545 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
585 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
624 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
665 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
707 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
716 #if defined(STRUMPACK_USE_MPI)
747 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
786 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
826 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
863 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
901 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
This file contains the ClusterTree class definition.
Contains the DenseMatrix and DenseMatrixWrapper classes, simple wrappers around BLAS/LAPACK style den...
Contains the class definition for StructuredOptions, as well as some routines to get default options,...
This is a small wrapper class around a BLACS grid and a BLACS context.
Definition: BLACSGrid.hpp:66
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:52
Wrapper class around an MPI_Comm object.
Definition: MPIWrapper.hpp:194
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
virtual void mult(Trans op, const DistributedMatrix< scalar_t > &x, DistributedMatrix< scalar_t > &y) const
virtual std::size_t begin_row() const
Definition: StructuredMatrix.hpp:274
void mult(Trans op, int m, const scalar_t *x, int ldx, scalar_t *y, int ldy) const
virtual const std::vector< int > & cdist() const
Definition: StructuredMatrix.hpp:320
virtual std::size_t rows() const =0
virtual std::size_t memory() const =0
virtual std::size_t cols() const =0
virtual void solve(int nrhs, scalar_t *b, int ldb) const
Definition: StructuredMatrix.hpp:389
virtual std::size_t nonzeros() const =0
virtual const std::vector< int > & rdist() const
Definition: StructuredMatrix.hpp:310
virtual void shift(scalar_t s)
virtual ~StructuredMatrix()=default
virtual const std::vector< int > & dist() const
Definition: StructuredMatrix.hpp:299
virtual std::size_t end_row() const
Definition: StructuredMatrix.hpp:286
virtual void solve(DistributedMatrix< scalar_t > &b) const
virtual std::size_t rank() const =0
virtual void solve(DenseMatrix< scalar_t > &b) const
virtual std::size_t local_rows() const
Definition: StructuredMatrix.hpp:262
virtual void mult(Trans op, const DenseMatrix< scalar_t > &x, DenseMatrix< scalar_t > &y) const
Class containing several options for the StructuredMatrix code and data-structures.
Definition: StructuredOptions.hpp:106
std::unique_ptr< StructuredMatrix< scalar_t > > construct_partially_matrix_free(int rows, int cols, const mult_t< scalar_t > &Amult, const extract_block_t< scalar_t > &Aelem, const StructuredOptions< scalar_t > &opts, const structured::ClusterTree *row_tree=nullptr, const structured::ClusterTree *col_tree=nullptr)
std::unique_ptr< StructuredMatrix< scalar_t > > construct_from_elements(int rows, int cols, const extract_t< scalar_t > &A, const StructuredOptions< scalar_t > &opts, const structured::ClusterTree *row_tree=nullptr, const structured::ClusterTree *col_tree=nullptr)
std::function< scalar_t(std::size_t i, std::size_t j)> extract_t
Definition: StructuredMatrix.hpp:68
std::function< void(const std::vector< std::size_t > &I, const std::vector< std::size_t > &J, DenseMatrix< scalar_t > &B)> extract_block_t
Definition: StructuredMatrix.hpp:83
std::unique_ptr< StructuredMatrix< scalar_t > > construct_from_dense(const DenseMatrix< scalar_t > &A, const StructuredOptions< scalar_t > &opts, const structured::ClusterTree *row_tree=nullptr, const structured::ClusterTree *col_tree=nullptr)
std::unique_ptr< StructuredMatrix< scalar_t > > construct_matrix_free(int rows, int cols, const mult_t< scalar_t > &Amult, const StructuredOptions< scalar_t > &opts, const structured::ClusterTree *row_tree=nullptr, const structured::ClusterTree *col_tree=nullptr)
std::function< void(Trans op, const DistributedMatrix< scalar_t > &R, DistributedMatrix< scalar_t > &S)> mult_2d_t
Definition: StructuredMatrix.hpp:137
std::function< void(Trans op, const DenseMatrix< scalar_t > &R, DenseMatrix< scalar_t > &S, const std::vector< int > &rdist, const std::vector< int > &cdist)> mult_1d_t
Definition: StructuredMatrix.hpp:163
std::function< void(const std::vector< std::size_t > &I, const std::vector< std::size_t > &J, DistributedMatrix< scalar_t > &B)> extract_dist_block_t
Definition: StructuredMatrix.hpp:119
std::function< void(Trans op, const DenseMatrix< scalar_t > &R, DenseMatrix< scalar_t > &S)> mult_t
Definition: StructuredMatrix.hpp:101
Definition: StrumpackOptions.hpp:42
Trans
Definition: DenseMatrix.hpp:51