32#ifndef STRUCTURED_MATRIX_HPP
33#define STRUCTURED_MATRIX_HPP
44#if defined(STRUMPACK_USE_MPI)
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)
462 template<
typename scalar_t>
463 std::unique_ptr<StructuredMatrix<scalar_t>>
513 template<
typename scalar_t>
514 std::unique_ptr<StructuredMatrix<scalar_t>>
559 template<
typename scalar_t,
560 typename real_t =
typename RealType<scalar_t>::value_type>
561 std::unique_ptr<StructuredMatrix<scalar_t>>
609 template<
typename scalar_t,
610 typename real_t =
typename RealType<scalar_t>::value_type>
611 std::unique_ptr<StructuredMatrix<scalar_t>>
654 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
697 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
740 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
780 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
821 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
863 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
872#if defined(STRUMPACK_USE_MPI)
903 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
943 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
985 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
1023 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
1061 template<
typename scalar_t> std::unique_ptr<StructuredMatrix<scalar_t>>
1105 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 DistributedMatrix and DistributedMatrixWrapper classes, wrappers around ScaLAPACK/PBLAS ...
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:1018
This class represents a matrix, stored in column major format, to allow direct use of BLAS/LAPACK rou...
Definition DenseMatrix.hpp:139
2D block cyclicly distributed matrix, as used by ScaLAPACK.
Definition DistributedMatrix.hpp:84
Wrapper class around an MPI_Comm object.
Definition MPIWrapper.hpp:173
The cluster tree, or partition tree that represents the partitioning of the rows or columns of a hier...
Definition ClusterTree.hpp:67
Class to represent a structured matrix. This is the abstract base class for several types of structur...
Definition StructuredMatrix.hpp:209
virtual const std::vector< int > & rdist() const
Definition StructuredMatrix.hpp:310
virtual const std::vector< int > & dist() const
Definition StructuredMatrix.hpp:299
virtual const std::vector< int > & cdist() const
Definition StructuredMatrix.hpp:320
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 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 void shift(scalar_t s)
virtual ~StructuredMatrix()=default
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::function< scalar_t(std::size_t i, std::size_t j)> extract_t
Definition StructuredMatrix.hpp:68
std::unique_ptr< StructuredMatrix< scalar_t > > construct_and_factor_from_dense(const DenseMatrix< scalar_t > &A, const StructuredOptions< scalar_t > &opts, const structured::ClusterTree *row_tree=nullptr, const structured::ClusterTree *col_tree=nullptr, const admissibility_t *adm=nullptr)
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_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, const admissibility_t *adm=nullptr, const DenseMatrix< real_t > *p=nullptr)
std::function< void(Trans op, const DistributedMatrix< scalar_t > &R, DistributedMatrix< scalar_t > &S)> mult_2d_t
Definition StructuredMatrix.hpp:137
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 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::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_and_factor_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, const admissibility_t *adm=nullptr)
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::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, const admissibility_t *adm=nullptr)
std::function< void(Trans op, const DenseMatrix< scalar_t > &R, DenseMatrix< scalar_t > &S)> mult_t
Definition StructuredMatrix.hpp:101
Definition StrumpackOptions.hpp:44
Trans
Definition DenseMatrix.hpp:51