strumpack::HSS::HSSMatrixBase< scalar_t > Class Template Referenceabstract

Abstract base class for Hierarchically Semi-Separable (HSS) matrices. More...

#include <HSSMatrixBase.hpp>

Inheritance diagram for strumpack::HSS::HSSMatrixBase< scalar_t >:

Public Member Functions

 HSSMatrixBase (std::size_t m, std::size_t n, bool active)
 
virtual ~HSSMatrixBase ()=default
 
 HSSMatrixBase (const HSSMatrixBase< scalar_t > &other)
 
HSSMatrixBase< scalar_t > & operator= (const HSSMatrixBase< scalar_t > &other)
 
 HSSMatrixBase (HSSMatrixBase &&h)=default
 
HSSMatrixBaseoperator= (HSSMatrixBase &&h)=default
 
virtual std::unique_ptr< HSSMatrixBase< scalar_t > > clone () const =0
 
std::pair< std::size_t, std::size_t > dims () const
 
std::size_t rows () const
 
std::size_t cols () const
 
bool leaf () const
 
const HSSMatrixBase< scalar_t > & child (int c) const
 
HSSMatrixBase< scalar_t > & child (int c)
 
bool is_compressed () const
 
bool is_untouched () const
 
bool active () const
 
virtual std::size_t rank () const =0
 
virtual std::size_t memory () const =0
 
virtual std::size_t nonzeros () const =0
 
virtual std::size_t levels () const =0
 
virtual void print_info (std::ostream &out=std::cout, std::size_t roff=0, std::size_t coff=0) const =0
 
void set_openmp_task_depth (int depth)
 
virtual void shift (scalar_t sigma)=0
 
virtual void draw (std::ostream &of, std::size_t rlo, std::size_t clo) const
 
virtual void forward_solve (const HSSFactorsMPI< scalar_t > &ULV, WorkSolveMPI< scalar_t > &w, const DistM_t &b, bool partial) const
 
virtual void backward_solve (const HSSFactorsMPI< scalar_t > &ULV, WorkSolveMPI< scalar_t > &w, DistM_t &x) const
 
virtual const BLACSGridgrid () const
 
virtual const BLACSGridgrid (const BLACSGrid *local_grid) const
 
virtual const BLACSGridgrid_local () const
 
virtual int Ptotal () const
 
virtual int Pactive () const
 
virtual void to_block_row (const DistM_t &A, DenseM_t &sub_A, DistM_t &leaf_A) const
 
virtual void allocate_block_row (int d, DenseM_t &sub_A, DistM_t &leaf_A) const
 
virtual void from_block_row (DistM_t &A, const DenseM_t &sub_A, const DistM_t &leaf_A, const BLACSGrid *lg) const
 

Friends

class HSSMatrix< scalar_t >
 
class HSSMatrixMPI< scalar_t >
 

Detailed Description

template<typename scalar_t>
class strumpack::HSS::HSSMatrixBase< scalar_t >

Abstract base class for Hierarchically Semi-Separable (HSS) matrices.

This is for non-symmetric HSS matrices, but can be used with symmetric matrices as well.

Template Parameters
scalar_tCan be float, double, std:complex<float> or std::complex<double>.
See also
HSSMatrix, HSSMatrixMPI

Constructor & Destructor Documentation

◆ HSSMatrixBase() [1/3]

template<typename scalar_t >
strumpack::HSS::HSSMatrixBase< scalar_t >::HSSMatrixBase ( std::size_t  m,
std::size_t  n,
bool  active 
)

Construct an m x n HSS matrix, not initialized.

Parameters
mnumber of rows
nnumber of columns
activeDenote if this matrix (node) is active on this process.

◆ ~HSSMatrixBase()

template<typename scalar_t >
virtual strumpack::HSS::HSSMatrixBase< scalar_t >::~HSSMatrixBase ( )
virtualdefault

Default virtual destructor.

◆ HSSMatrixBase() [2/3]

template<typename scalar_t >
strumpack::HSS::HSSMatrixBase< scalar_t >::HSSMatrixBase ( const HSSMatrixBase< scalar_t > &  other)

Copy constructor.

Parameters
otherHSS matrix to copy.

◆ HSSMatrixBase() [3/3]

template<typename scalar_t >
strumpack::HSS::HSSMatrixBase< scalar_t >::HSSMatrixBase ( HSSMatrixBase< scalar_t > &&  h)
default

Move constructor.

Parameters
hHSS matrix to move from, h will be emptied.

Member Function Documentation

◆ active()

template<typename scalar_t >
bool strumpack::HSS::HSSMatrixBase< scalar_t >::active ( ) const
inline

Check if this HSS matrix (or node in the HSS tree) is active on this rank.

Returns
True if this node is active, false otherwise.

◆ child() [1/2]

template<typename scalar_t >
HSSMatrixBase<scalar_t>& strumpack::HSS::HSSMatrixBase< scalar_t >::child ( int  c)
inline

Return a reference to the child (0, or 1) of this HSS matrix. This is only valid when !this->leaf(). It is assumed that a non-leaf node always has exactly 2 children.

Parameters
cNumber of the child, should be 0 or 1, for the left or the right child.
Returns
Reference to the child (HSSMatrixBase).

◆ child() [2/2]

template<typename scalar_t >
const HSSMatrixBase<scalar_t>& strumpack::HSS::HSSMatrixBase< scalar_t >::child ( int  c) const
inline

Return a const reference to the child (0, or 1) of this HSS matrix. This is only valid when !this->leaf(). It is assumed that a non-leaf node always has exactly 2 children.

Parameters
cNumber of the child, should be 0 or 1, for the left or the right child.
Returns
Const reference to the child (HSSMatrixBase).

◆ clone()

template<typename scalar_t >
virtual std::unique_ptr<HSSMatrixBase<scalar_t> > strumpack::HSS::HSSMatrixBase< scalar_t >::clone ( ) const
pure virtual

Clone this HSS matrix. TODO delete this??

Returns
std::unique_ptr to a clone of this HSS matrix.

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ cols()

template<typename scalar_t >
std::size_t strumpack::HSS::HSSMatrixBase< scalar_t >::cols ( ) const
inline

Return the number of columns in this HSS matrix.

Returns
number of columns

◆ dims()

template<typename scalar_t >
std::pair<std::size_t,std::size_t> strumpack::HSS::HSSMatrixBase< scalar_t >::dims ( ) const
inline

Returns the dimensions of this HSS matrix, as a pair.

Returns
pair with number of rows and columns of this HSS matrix.

◆ draw()

template<typename scalar_t >
virtual void strumpack::HSS::HSSMatrixBase< scalar_t >::draw ( std::ostream &  of,
std::size_t  rlo,
std::size_t  clo 
) const
inlinevirtual

Internal routine to draw this HSS matrix. Do not use this directly. Use HSS::draw.

See also
HSS::draw

Reimplemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ is_compressed()

template<typename scalar_t >
bool strumpack::HSS::HSSMatrixBase< scalar_t >::is_compressed ( ) const
inline

Check whether the HSS matrix was compressed.

Returns
True if this HSS matrix was succesfully compressed, false otherwise.
See also
is_untouched

◆ is_untouched()

template<typename scalar_t >
bool strumpack::HSS::HSSMatrixBase< scalar_t >::is_untouched ( ) const
inline

Check whether the HSS compression was started for this matrix.

Returns
True if HSS compression was not started yet, false otherwise. False may mean that compression was started but failed, or that compression succeeded.
See also
is_compressed

◆ leaf()

template<typename scalar_t >
bool strumpack::HSS::HSSMatrixBase< scalar_t >::leaf ( ) const
inline

Check whether this node of the HSS tree is a leaf.

Returns
true if this node is a leaf, false otherwise.

◆ levels()

template<typename scalar_t >
virtual std::size_t strumpack::HSS::HSSMatrixBase< scalar_t >::levels ( ) const
pure virtual

Return the number of levels in the HSS matrix.

Returns
Number of HSS levels (>= 1).

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ memory()

template<typename scalar_t >
virtual std::size_t strumpack::HSS::HSSMatrixBase< scalar_t >::memory ( ) const
pure virtual

Return the total amount of memory used by this HSS matrix, in bytes. This counts the memory for the low rank basis matrices as well as some of the memory used for the data structures.

Returns
Memory usage in bytes.
See also
nonzeros

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ nonzeros()

template<typename scalar_t >
virtual std::size_t strumpack::HSS::HSSMatrixBase< scalar_t >::nonzeros ( ) const
pure virtual

Return the total number of nonzeros stored in the HSS generator matrices (D,U,V at leafs U,B,V at non-leafs).

Returns
Nonzeros in the HSS representation.
See also
memory

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ operator=() [1/2]

template<typename scalar_t >
HSSMatrixBase<scalar_t>& strumpack::HSS::HSSMatrixBase< scalar_t >::operator= ( const HSSMatrixBase< scalar_t > &  other)

Copy assignment operator, makes a deep copy.

Parameters
otherHSS matrix to copy.
Returns
reference to this HSS matrix.

◆ operator=() [2/2]

template<typename scalar_t >
HSSMatrixBase& strumpack::HSS::HSSMatrixBase< scalar_t >::operator= ( HSSMatrixBase< scalar_t > &&  h)
default

Move assignment operator.

Parameters
hHSS matrix to move from, h will be emptied.
Returns
reference to this HSS matrix.

◆ print_info()

template<typename scalar_t >
virtual void strumpack::HSS::HSSMatrixBase< scalar_t >::print_info ( std::ostream &  out = std::cout,
std::size_t  roff = 0,
std::size_t  coff = 0 
) const
pure virtual

Print info about this HSS matrix, such as tree info, ranks, etc.

Parameters
outStream to print to, defaults to std::cout
roffRow offset of top left corner, defaults to 0. This is used to recursively print the tree, you can leave this at the default.
coffColumn offset of top left corner, defaults to 0. This is used to recursively print the tree, you can leave this at the default.

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ rank()

template<typename scalar_t >
virtual std::size_t strumpack::HSS::HSSMatrixBase< scalar_t >::rank ( ) const
pure virtual

Return the maximum rank of this HSS matrix over all off-diagonal blocks, and all levels.

Returns
Maximum HSS rank.

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.

◆ rows()

template<typename scalar_t >
std::size_t strumpack::HSS::HSSMatrixBase< scalar_t >::rows ( ) const
inline

Return the number of rows in this HSS matrix.

Returns
number of rows

◆ set_openmp_task_depth()

template<typename scalar_t >
void strumpack::HSS::HSSMatrixBase< scalar_t >::set_openmp_task_depth ( int  depth)
inline

Set the depth of openmp nested tasks. This can be used to limit the number of tasks to spawn in the HSS routines, which is can reduce task creation overhead. This is used in the sparse solver when multiple HSS matrices are created from within multiple openmp tasks. The HSS routines all use openmp tasking to traverse the HSS tree and for parallelism within the HSS nodes as well.

◆ shift()

template<typename scalar_t >
virtual void strumpack::HSS::HSSMatrixBase< scalar_t >::shift ( scalar_t  sigma)
pure virtual

APply a shift to the diagonal of this matrix. Ie, this += sigma * I, with I the identity matrix. Call this after compression.

Parameters
sigmaShift to be applied to the diagonal.

Implemented in strumpack::HSS::HSSMatrix< scalar_t >.


The documentation for this class was generated from the following file: