HLIBpro  2.4
Public Member Functions | List of all members
TH2Matrix Class Reference

Class for an H²-matrix, which extends block matrices with additional functionality, e.g. permutations and uniform vectors.

#include <TH2Matrix.hh>

Inheritance diagram for TH2Matrix:
TBlockMatrix TMatrix TLinearOperator TLockable TTypeInfo

Public Member Functions

 TH2Matrix ()
 default ctor without cluster bases
 
 TH2Matrix (const TBlockIndexSet &bis, const TClusterBasis< real > *row_cb, const TClusterBasis< real > *col_cb)
 
 TH2Matrix (const TBlockIndexSet &bis, const TClusterBasis< complex > *row_cb, const TClusterBasis< complex > *col_cb)
 
 TH2Matrix (const TBlockIndexSet &bis, const TClusterBasis< real > *row_cb, const TClusterBasis< real > *col_cb, const TPermutation &row_perm_e2i, const TPermutation &col_perm_e2i)
 
 TH2Matrix (const TBlockIndexSet &bis, const TClusterBasis< complex > *row_cb, const TClusterBasis< complex > *col_cb, const TPermutation &row_perm_e2i, const TPermutation &col_perm_e2i)
 
virtual real entry (const idx_t i, const idx_t j) const
 access single matrix coefficient
 
virtual const complex centry (const idx_t i, const idx_t j) const
 return matrix coefficient (i, j)
 
const TClusterBasis< real > * rrow_cb () const
 access row cluster basis
 
const TClusterBasis< real > * rcol_cb () const
 access column cluster basis
 
void assign_cb (const TClusterBasis< real > *row_cb, const TClusterBasis< real > *col_cb)
 
void set_row_perm (const TPermutation &perm_e2i, const TPermutation &perm_i2e)
 set row permutations
 
void set_col_perm (const TPermutation &perm_e2i, const TPermutation &perm_i2e)
 set column permutations
 
const TPermutationrow_perm_e2i () const
 access row permutation (extern to intern)
 
const TPermutationrow_perm_i2e () const
 access row permutation (intern to extern)
 
const TPermutationcol_perm_e2i () const
 access column permutation (extern to intern)
 
const TPermutationcol_perm_i2e () const
 access column permutation (intern to extern)
 
bool has_perm () const
 return true if all mappings are present and of correct size
 
virtual void mul_vec (const real alpha, const TVector *x, const real beta, TVector *y, const matop_t op=MATOP_NORM) const
 compute y ≔ β·y + α·op(M)·x, with M = this
 
virtual void cmul_vec (const complex alpha, const TVector *x, const complex beta, TVector *y, const matop_t op=MATOP_NORM) const
 compute y ≔ β·y + α·op(M)·x, with M = this
 
virtual auto create () const -> std::unique_ptr< TMatrix >
 return matrix of same class (but no content)
 
virtual auto copy () const -> std::unique_ptr< TMatrix >
 return copy of matrix
 
virtual auto copy (const TTruncAcc &acc, const bool coarsen=false) const -> std::unique_ptr< TMatrix >
 copy matrix wrt. accuracy acc and optional coarsening
 
virtual void copy_to (TMatrix *A) const
 copy matrix into A
 
virtual void copy_to (TMatrix *A, const TTruncAcc &acc, const bool coarsen=false) const
 copy matrix into A with accuracy acc and optional coarsening
 
virtual void copy_struct (const TMatrix *A)
 copy complete structural information from given matrix
 
virtual auto row_vector () const -> std::unique_ptr< TVector >
 return appropriate row vector type for matrix
 
virtual auto col_vector () const -> std::unique_ptr< TVector >
 return appropriate column vector type for matrix
 
virtual size_t byte_size () const
 return size in bytes used by this object
 
virtual void read (TByteStream &s)
 read data from stream s and copy to matrix
 
virtual void build (TByteStream &s)
 use data from stream s to build matrix
 
virtual void write (TByteStream &s) const
 write data to stream s
 
virtual size_t bs_size () const
 returns size of object in bytestream
 
- Public Member Functions inherited from TBlockMatrix
 TBlockMatrix (const TBlockCluster *bct=nullptr)
 construct block matrix with size and block structure defined by bct
 
 TBlockMatrix (const TBlockIndexSet &bis)
 construct block matrix with over block index set bis
 
virtual ~TBlockMatrix ()
 dtor
 
virtual void set_cluster (const TBlockCluster *c)
 set cluster of matrix
 
virtual size_t rows () const
 return number of rows
 
virtual size_t cols () const
 return number of columns
 
void set_size (const size_t r, const size_t c)
 set size of matrix
 
uint block_rows () const
 return number of block-rows
 
uint block_cols () const
 return number of block-columns
 
uint no_of_blocks () const
 return number of sub blocks of matrix
 
void set_block_struct (const uint n, const uint m)
 set block structure
 
virtual void set_form (const matform_t f)
 set matrix format
 
virtual void set_form (const matform_t f, const recursive_type_t t)
 set matrix format
 
TMatrixblock (const uint i, const uint j)
 return block at block index (i, j)
 
const TMatrixblock (const uint i, const uint j) const
 return block at block index (i, j)
 
void set_block (const uint i, const uint j, TMatrix *A)
 set matrix block at block index (i,j) to matrix A
 
void replace_block (TMatrix *A, TMatrix *B)
 replace matrix block A by matrix B (don't delete A !)
 
void delete_block (const uint i, const uint j)
 delete block (i,j)
 
TMatrixbc_block (const TBlockCluster *t) const
 return subblock of matrix corresponding to block cluster t
 
TMatrixbc_block (const TCluster *tau, const TCluster *sigma) const
 return subblock of matrix corresponding to block cluster (tau, sigma)
 
void clear_blocks ()
 clear pointers to all sub blocks
 
virtual void to_real ()
 convert data to real valued representation (if possible)
 
virtual void to_complex ()
 convert data to complex valued representation (if possible)
 
virtual void adjust_value_type ()
 make value type of this and all sub blocks consistent
 
virtual bool is_blocked () const
 return true, if matrix is blocked
 
virtual void set_procs (const TProcSet &ps, const bool recursive=false)
 set processor set of matrix
 
virtual void scale (const real alpha)
 compute this ≔ α·this
 
virtual void add (const real alpha, const TMatrix *matrix)
 compute this ≔ this + α · matrix
 
virtual void cscale (const complex alpha)
 compute this ≔ α·this
 
virtual void cadd (const complex alpha, const TMatrix *matrix)
 compute this ≔ this + α · matrix
 
template<typename T_list >
void collect_leaves (T_list &leaf_list) const
 collect matrix blocks corresponding to leaves in list leaf_list
 
virtual void transpose ()
 transpose matrix
 
virtual void conjugate ()
 conjugate matrix coefficients
 
virtual void truncate (const TTruncAcc &acc)
 truncate all rank-blocks in matrix to accuracy acc
 
virtual void print (const uint ofs=0) const
 print matrix to stdout
 
virtual void check_data () const
 test data for invalid values, e.g. INF and NAN
 
- Public Member Functions inherited from TMatrix
 TMatrix (const value_type_t avalue_type=real_valued)
 construct zero sized matrix
 
 TMatrix (const TBlockCluster *bcl, const value_type_t avalue_type=real_valued)
 construct matrix of size defined by block cluster bcl
 
 TMatrix (const TBlockIndexSet &bis, const value_type_t avalue_type=real_valued)
 construct matrix of size defined by block index set bis
 
 TMatrix (const TMatrix &A)
 copy constructor
 
virtual ~TMatrix ()
 dtor
 
int id () const
 return ID
 
void set_id (const int aid)
 set ID
 
TIndexSet row_is () const
 return row index set
 
TIndexSet col_is () const
 return column index set
 
TBlockIndexSet block_is () const
 return block index set
 
TIndexSet row_is (const matop_t op) const
 return row index set w.r.t. given matrix operation
 
TIndexSet col_is (const matop_t op) const
 return row index set w.r.t. given matrix operation
 
TBlockIndexSet block_is (const matop_t op) const
 return row index set w.r.t. given matrix operation
 
virtual idx_t row_ofs () const
 return first index (number) in row
 
virtual idx_t col_ofs () const
 return first index (number) in column
 
virtual void set_ofs (const idx_t r, const idx_t c)
 set index set offsets
 
virtual void set_block_is (const TBlockIndexSet &is)
 set block index set of matrix
 
bool is_nonsym () const
 return true if matrix is unsymmetric
 
bool is_symmetric () const
 return true if matrix is symmetric
 
bool is_hermitian () const
 return true if matrix is hermitian
 
matform_t form () const
 return matrix format
 
void set_nonsym ()
 set matrix to be unsymmetric
 
void set_symmetric ()
 set matrix to be symmetric
 
void set_hermitian ()
 set matrix to be hermitian
 
virtual bool is_zero () const
 return true, if matrix is zero
 
virtual bool is_dense () const
 return true, if matrix is dense
 
virtual bool is_self_adjoint () const
 return true, if operator is self adjoint
 
const TProcSetprocs () const
 return matrix processor set
 
uint nprocs () const
 return number of processors in local set
 
value_type_t value_type () const
 return value type of matrix
 
void set_value_type (const value_type_t vt)
 set value type of matrix
 
bool is_real () const
 return true if matrix is real valued
 
bool is_complex () const
 return true if matrix is complex valued
 
void set_complex (const bool b, const bool force=false)
 
const TBlockClustercluster () const
 return corresponding block cluster of matrix
 
virtual void apply (const TVector *x, TVector *y, const matop_t op) const
 
virtual void apply_add (const real alpha, const TVector *x, TVector *y, const matop_t op) const
 
virtual auto domain_vector () const -> std::unique_ptr< TVector >
 return vector in domain space
 
virtual auto range_vector () const -> std::unique_ptr< TVector >
 return vector in range space
 
virtual TMatrixmul_right (const real alpha, const TMatrix *B, const matop_t op_A, const matop_t op_B) const
 compute α·op(A)·op(B), with A = this
 
virtual TMatrixmul_left (const real alpha, const TMatrix *A, const matop_t op_A, const matop_t op_B) const
 compute α·op(A)·op(B), with B = this
 
virtual TMatrixcmul_right (const complex alpha, const TMatrix *B, const matop_t op_A, const matop_t op_B) const
 compute α·op(A)·op(B), with A = this
 
virtual TMatrixcmul_left (const complex alpha, const TMatrix *A, const matop_t op_A, const matop_t op_B) const
 compute α·op(A)·op(B), with B = this
 
virtual size_t global_byte_size () const
 
virtual void sum (const TProcSet &p, const uint pid, const uint nparts, TByteStream *bs, const TTruncAcc &acc)
 
- Public Member Functions inherited from TTypeInfo
virtual typeid_t type () const =0
 return type ID of object
 
virtual bool is_type (const typeid_t t) const
 return true if local object is of given type ID t
 
virtual std::string typestr () const
 return string representation of type
 
- Public Member Functions inherited from TLockable
TMutexmutex ()
 give access to internal mutex
 
void lock ()
 lock local mutex
 
void unlock ()
 unlock local mutex
 
size_t byte_size () const
 return size in bytes used by this object
 

Constructor & Destructor Documentation

TH2Matrix ( const TBlockIndexSet bis,
const TClusterBasis< real > *  row_cb,
const TClusterBasis< real > *  col_cb 
)

construct H²-matrix over block index set bis with cluster bases row_cb and col_cb

TH2Matrix ( const TBlockIndexSet bis,
const TClusterBasis< complex > *  row_cb,
const TClusterBasis< complex > *  col_cb 
)

construct H²-matrix over block index set bis with cluster bases row_cb and col_cb

TH2Matrix ( const TBlockIndexSet bis,
const TClusterBasis< real > *  row_cb,
const TClusterBasis< real > *  col_cb,
const TPermutation row_perm_e2i,
const TPermutation col_perm_e2i 
)

construct H²-matrix over block index set bis with cluster bases row_cb and col_cb and permutations row_perm_e2i and col_perm_e2i

TH2Matrix ( const TBlockIndexSet bis,
const TClusterBasis< complex > *  row_cb,
const TClusterBasis< complex > *  col_cb,
const TPermutation row_perm_e2i,
const TPermutation col_perm_e2i 
)

construct H²-matrix over block index set bis with cluster bases row_cb and col_cb and permutations row_perm_e2i and col_perm_e2i

Member Function Documentation

void assign_cb ( const TClusterBasis< real > *  row_cb,
const TClusterBasis< real > *  col_cb 
)

assign cluster bases to local matrix and to all uniform sub blocks

  • rank and value type of bases must be identical to corresponding dimension and value type of coefficient matrices (also in sub blocks!)