HLIBpro  2.0
Public Member Functions | List of all members
TRkMatrix Class Reference

Represents low rank matrices in factored form: $ M = A B^H $.

#include <TRkMatrix.hh>

Inheritance diagram for TRkMatrix:
TMatrix TLinearOperator TLockable TTypeInfo

Public Member Functions

 TRkMatrix ()
 construct zero sized low-rank matrix
 
 TRkMatrix (const size_t rows, const size_t cols)
 construct low-rank matrix of size rows × cols
 
 TRkMatrix (const TBlockIndexSet &block_is)
 construct low-rank matrix of size defined by block index set
 
 TRkMatrix (const TIndexSet &arow_is, const TIndexSet &acol_is, const bool acomplex)
 construct low-rank matrix of size defined by block index set
 
 TRkMatrix (const TIndexSet &arow_is, const TIndexSet &acol_is, const BLAS::Matrix< real > &A, const BLAS::Matrix< real > &B)
 
 TRkMatrix (const TIndexSet &arow_is, const TIndexSet &acol_is, const BLAS::Matrix< complex > &A, const BLAS::Matrix< complex > &B)
 
 TRkMatrix (const TBlockCluster *cluster)
 construct low-rank matrix of size defined by block cluster
 
 TRkMatrix (const TRkMatrix &A)
 copy constructor
 
 ~TRkMatrix ()
 destructor
 
virtual bool is_zero () const
 return true, if matrix is zero
 
real * matrix_A ()
 return pointer to internal matrix data of matrix A
 
const real * matrix_A () const
 return const pointer to internal matrix data of matrix A
 
complexcmatrix_A ()
 return pointer to internal matrix data of matrix A
 
const complexcmatrix_A () const
 return const pointer to internal matrix data of matrix A
 
real * matrix_B ()
 return pointer to internal matrix data of matrix B
 
const real * matrix_B () const
 return const pointer to internal matrix data of matrix B
 
complexcmatrix_B ()
 return pointer to internal matrix data of matrix B
 
const complexcmatrix_B () const
 return const pointer to internal matrix data of matrix B
 
BLAS::Matrix< real > & blas_rmat_A ()
 return pointer to internal matrix data of matrix A
 
const BLAS::Matrix< real > & blas_rmat_A () const
 return const pointer to internal matrix data of matrix A
 
BLAS::Matrix< complex > & blas_cmat_A ()
 return pointer to internal matrix data of matrix A
 
const BLAS::Matrix< complex > & blas_cmat_A () const
 return const pointer to internal matrix data of matrix A
 
BLAS::Matrix< real > & blas_rmat_B ()
 return pointer to internal matrix data of matrix B
 
const BLAS::Matrix< real > & blas_rmat_B () const
 return const pointer to internal matrix data of matrix B
 
BLAS::Matrix< complex > & blas_cmat_B ()
 return pointer to internal matrix data of matrix B
 
const BLAS::Matrix< complex > & blas_cmat_B () const
 return const pointer to internal matrix data of matrix B
 
const BLAS::Vector< real > blas_rvec_A (const idx_t i) const
 return vector A_i
 
const BLAS::Vector< real > blas_rvec_B (const idx_t i) const
 return vector B_i
 
const BLAS::Vector< complexblas_cvec_A (const idx_t i) const
 return vector A_i
 
const BLAS::Vector< complexblas_cvec_B (const idx_t i) const
 return vector B_i
 
const TVirtualVector vec_A (const idx_t i) const
 return vector A_i
 
const TVirtualVector vec_B (const idx_t i) const
 return vector B_i
 
size_t rank () const
 return rank of matrix
 
void set_rank (const size_t k)
 set rank of matrix without truncating data
 
void comp_rank ()
 compute actual rank of matrix (remove zero vectors)
 
virtual size_t rows () const
 return number of rows
 
virtual size_t cols () const
 return number of columns
 
virtual void set_cluster (const TBlockCluster *c)
 set new cluster over which matrix is defined and change size accordingly
 
void set_size (const size_t n, const size_t m, const size_t k)
 set size and rank of matrix (if zero == true fill new memory with zeros)
 
void set_size (const size_t n, const size_t m)
 set new size but keep current rank of matrix
 
real entry (const idx_t i, const idx_t j) const
 return real valued coefficent (i, j) of matrix
 
const complex centry (const idx_t i, const idx_t j) const
 return complex valued coefficent (i, j) of matrix
 
virtual void to_real ()
 switch to real valued storage if possible, e.g. all imaginary components zero
 
virtual void to_complex ()
 switch to complex valued storage
 
virtual void transpose ()
 transpose matrix
 
virtual void conjugate ()
 conjugate matrix coefficients
 
virtual void truncate (const TTruncAcc &acc)
 truncate matrix w.r.t. accuracy acc
 
void add_rank (const real alpha, const BLAS::Matrix< real > &A, const BLAS::Matrix< real > &B, const TTruncAcc &acc)
 compute this ≔ this + α·A·B^H and truncate result w.r.t. acc (real valued variant)
 
void add_rank (const complex alpha, const BLAS::Matrix< complex > &A, const BLAS::Matrix< complex > &B, const TTruncAcc &acc)
 compute this ≔ this + α·A·B^H and truncate result w.r.t. acc (complex valued variant)
 
void add_dense (const real alpha, const BLAS::Matrix< real > &D, const TTruncAcc &acc)
 add a dense matrix and truncate w.r.t. acc (real valued variant)
 
void add_dense (const complex alpha, const BLAS::Matrix< complex > &D, const TTruncAcc &acc)
 add a dense matrix and truncate w.r.t. acc (complex valued variant)
 
void copy_dense (const TDenseMatrix *A, const TTruncAcc &acc)
 copy a densematrix (nxm) as low-rank matrix (rank = min{n,m})
 
virtual void scale (const real f)
 scale matrix by constant factor
 
virtual void mul_vec (const real alpha, const TVector *x, const real beta, TVector *y, const matop_t op=MATOP_NORM) const
 compute y ≔ α·M·x + β·y, where M is either this, this^T or this^H depending on op
 
virtual void add (const real alpha, const TMatrix *A)
 compute this = this + α·A without truncation
 
virtual TRkMatrixmul_right (const real alpha, const TMatrix *B, const matop_t op_A, const matop_t op_B) const
 compute matrix product α·op_A(this)·op_B(B)
 
virtual TRkMatrixmul_left (const real alpha, const TMatrix *A, const matop_t op_A, const matop_t op_B) const
 compute matrix product α·op_A(A)·op_B(this)
 
virtual void cscale (const complex f)
 scale matrix by constant factor
 
virtual void cmul_vec (const complex alpha, const TVector *x, const complex beta, TVector *y, const matop_t op_A=MATOP_NORM) const
 compute y ≔ α·M·x + β·y, where M is either this, this^T or this^H depending on op
 
virtual void cadd (const complex a, const TMatrix *matrix)
 compute this = this + α·A without truncation
 
virtual TRkMatrixcmul_right (const complex alpha, const TMatrix *B, const matop_t op_A, const matop_t op_B) const
 compute matrix product α·op_A(this)·op_B(B)
 
virtual TRkMatrixcmul_left (const complex alpha, const TMatrix *A, const matop_t op_A, const matop_t op_B) const
 compute matrix product α·op_A(A)·op_B(this)
 
virtual TMatrixcreate () const
 return object of same type
 
virtual TMatrixcopy () const
 return copy of matrix
 
virtual TMatrixcopy (const TTruncAcc &acc, const bool do_coarsen=false) const
 return copy matrix wrt. given accuracy; if do_coarsen is set, perform coarsening
 
virtual void copy_to (TMatrix *A) const
 copy matrix into matrix A
 
virtual void copy_to (TMatrix *A, const TTruncAcc &acc, const bool do_coarsen=false) const
 copy matrix into matrix A with accuracy acc and optional coarsening
 
virtual size_t byte_size () const
 return size in bytes used by this object
 
virtual typeid_t type () const
 return type id of class
 
virtual bool is_type (const typeid_t t) const
 return true if object is of type t
 
virtual void read (TByteStream &s)
 read matrix from byte stream
 
virtual void build (TByteStream &s)
 construct matrix from byte stream
 
virtual void write (TByteStream &s) const
 write matrix into byte stream
 
virtual size_t bs_size () const
 return size of object in a bytestream
 
virtual void check_data () const
 test data for invalid values, e.g. INF and NAN
 
- Public Member Functions inherited from TMatrix
 TMatrix (const bool acomplex=false)
 construct zero sized matrix
 
 TMatrix (const TBlockCluster *c)
 construct matrix of size defined by block cluster c
 
 TMatrix (const TBlockIndexSet &bis)
 construct matrix of size defined by block cluster c
 
 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
 
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 void set_form (const matform_t f)
 set matrix format
 
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
 
void set_procs (const TProcSet &ps)
 set processor set of matrix
 
virtual void copy_struct (const TMatrix *M)
 
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 TVectordomain_vector () const
 return vector in domain space
 
virtual TVectorrange_vector () const
 return vector in range space
 
virtual size_t global_byte_size () const
 
virtual TVectorrow_vector () const
 return appropriate row vector object for matrix
 
virtual TVectorcol_vector () const
 return appropriate column vector object for matrix
 
virtual void sum (const TProcSet &p, const uint pid, const uint nparts, TByteStream *bs, const TTruncAcc &acc)
 
virtual void print (const uint ofs=0) const
 print basic info about matrix to stdout
 
- 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
 
- Public Member Functions inherited from TTypeInfo
virtual std::string typestr () const
 return string representation of type
 

Constructor & Destructor Documentation

TRkMatrix ( const TIndexSet arow_is,
const TIndexSet acol_is,
const BLAS::Matrix< real > &  A,
const BLAS::Matrix< real > &  B 
)

construct low-rank matrix of size defined by block index set and real factors A and B

TRkMatrix ( const TIndexSet arow_is,
const TIndexSet acol_is,
const BLAS::Matrix< complex > &  A,
const BLAS::Matrix< complex > &  B 
)

construct low-rank matrix of size defined by block index set and complex factors A and B