TBCI Numerical high perf. C++ Library  2.8.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CRMatrix< T > Class Template Reference

C++ class for sparse matrices using compressed row storage. More...

#include <crmatrix.h>

Inheritance diagram for CRMatrix< T >:
Inheritance graph
[legend]
Collaboration diagram for CRMatrix< T >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 
typedef T element_type
 
typedef T aligned_value_type TALIGN (MIN_ALIGN2)
 

Public Member Functions

 CRMatrix ()
 
 CRMatrix (unsigned int rows, unsigned int columns)
 
 CRMatrix (const CRMatrix< T > &m)
 
 CRMatrix (const Matrix< T > &mat)
 
 ~CRMatrix ()
 
CRMatrix< T > & clear ()
 set all elements defined to zero More...
 
CRMatrix< T > & fill (const T &)
 set all defined element to a val More...
 
CRMatrix< T > & setunit (const T &=(T) 1)
 set CSCMatrix to val times the unit matrix More...
 
const Toperator() (unsigned int row, unsigned int column) const
 element access (read) More...
 
const Tget (unsigned int row, unsigned int column) const
 
CRMatrix< T > & setval (const T &z, unsigned int row, unsigned int column)
 element access (write) More...
 
Tsetval (unsigned int row, unsigned int column)
 
Toperator() (unsigned int row, unsigned int column)
 
TVector< Tget_row (unsigned int row) const
 
void set_row (const Vector< T > &v, unsigned int row)
 
void set_row (const TVector< T > &tv, unsigned int row)
 
void set_row (const TSVector< T > &tsv, unsigned int row)
 
void set_row (T *value, unsigned int row, unsigned int count, unsigned int *index)
 
unsigned int rows () const
 
unsigned int columns () const
 
unsigned int size () const
 
void resize (unsigned int newRows, unsigned int newColumns)
 
CRMatrix< T > & operator= (const CRMatrix< T > &m)
 
bool operator== (const CRMatrix< T > &m) const
 
bool operator!= (const CRMatrix< T > &m) const
 
CRMatrix< Toperator- () const
 
TVector< Toperator* (const Vector< T > &v) const
 
TVector< Toperator* (const TVector< T > &tv) const
 
TVector< Toperator* (TSVector< T > &tsv) const
 
void MatVecMult (Vector< T > &res, const Vector< T > &v) const
 
void MatVecMult (T *v, T *res)
 
TVector< TtransMult (const Vector< T > &v) const
 
TVector< TtransMult (const TVector< T > &tv) const
 
TVector< TtransMult (const TSVector< T > &tsv) const
 
CRMatrix< Toperator* (const T &z) const
 
CRMatrix< T > & operator*= (const T &z)
 
CRMatrix< Toperator/ (const T &z) const
 
CRMatrix< T > & operator/= (const T &z)
 
CRMatrix< Tmult (const T &z) const
 
CRMatrix< T > & swap (CRMatrix< T > &)
 
CRMatrix< Ttransposed_copy () const
 Inefficient! Use transMult if possible. More...
 
CRMatrix< T > & transpose ()
 
- Public Member Functions inherited from Matrix_Sig< T >
 Matrix_Sig ()
 
 ~Matrix_Sig ()
 
tbci_traits< T >::const_refval_type operator() (const unsigned, const unsigned) const
 ro access More...
 
Toperator() (const unsigned, const unsigned)
 rw access More...
 
Matrix_Sig< T > & fill (const T &)
 
Matrix_Sig< T > & setunit (const T &=(T) 1)
 
Matrix_Sig< T > & clear ()
 
TVector< Toperator* (const Vector_Sig< T > &) const
 
TVector< TtransMult (const Vector_Sig< T > &) const
 
unsigned int rows () const
 
unsigned int columns () const
 

Static Public Member Functions

static const char * mat_info ()
 
- Static Public Member Functions inherited from Matrix_Sig< T >
static const char * mat_info ()
 

Protected Member Functions

void allocate (unsigned int rows, unsigned int columns)
 
void destroy ()
 
void copy (const CRMatrix< T > &m)
 

Protected Attributes

unsigned int n_rows
 
unsigned int n_cols
 
unsigned int * rowSize
 
unsigned int ** colIndex
 
T ** comp
 
T dummy
 

Friends

STD__ ostream & operator<< FGD (STD__ ostream &stream, const CRMatrix< T > &m)
 

Detailed Description

template<typename T>
class CRMatrix< T >

C++ class for sparse matrices using compressed row storage.

Definition at line 63 of file crmatrix.h.

Member Typedef Documentation

template<typename T>
typedef T CRMatrix< T >::element_type

Definition at line 80 of file crmatrix.h.

template<typename T>
typedef T aligned_value_type CRMatrix< T >::TALIGN(MIN_ALIGN2)

Definition at line 81 of file crmatrix.h.

template<typename T>
typedef T CRMatrix< T >::value_type

Definition at line 79 of file crmatrix.h.

Constructor & Destructor Documentation

template<typename T>
CRMatrix< T >::CRMatrix ( )
inline

Definition at line 83 of file crmatrix.h.

References CRMatrix< T >::allocate().

template<typename T>
CRMatrix< T >::CRMatrix ( unsigned int  rows,
unsigned int  columns 
)
inline

Definition at line 84 of file crmatrix.h.

References CRMatrix< T >::allocate().

template<typename T>
CRMatrix< T >::CRMatrix ( const CRMatrix< T > &  m)
inline

Definition at line 85 of file crmatrix.h.

References CRMatrix< T >::copy().

template<typename T >
CRMatrix< T >::CRMatrix ( const Matrix< T > &  mat)

Definition at line 171 of file crmatrix.h.

References i.

template<typename T>
CRMatrix< T >::~CRMatrix ( )
inline

Definition at line 87 of file crmatrix.h.

References CRMatrix< T >::destroy().

Member Function Documentation

template<typename T >
void CRMatrix< T >::allocate ( unsigned int  rows,
unsigned int  columns 
)
protected

Definition at line 647 of file crmatrix.h.

References BCHKNR, i, NULL, and T.

Referenced by CRMatrix< T >::CRMatrix().

template<typename T >
CRMatrix< T > & CRMatrix< T >::clear ( )
inline

set all elements defined to zero

Definition at line 725 of file crmatrix.h.

References T.

template<typename T>
unsigned int CRMatrix< T >::columns ( ) const
inline

Definition at line 119 of file crmatrix.h.

References CRMatrix< T >::n_cols.

Referenced by operator<<().

template<typename T >
void CRMatrix< T >::copy ( const CRMatrix< T > &  m)
protected
template<typename T >
void CRMatrix< T >::destroy ( )
protected
template<typename T >
CRMatrix< T > & CRMatrix< T >::fill ( const T val)
inline

set all defined element to a val

Definition at line 716 of file crmatrix.h.

References i.

template<typename T>
const T& CRMatrix< T >::get ( unsigned int  row,
unsigned int  column 
) const
inline

Definition at line 101 of file crmatrix.h.

template<typename T >
TVector< T > CRMatrix< T >::get_row ( unsigned int  row) const

Definition at line 312 of file crmatrix.h.

References BCHK, index, and TVector< T >::set().

template<typename T>
static const char* CRMatrix< T >::mat_info ( )
inlinestatic

Definition at line 90 of file crmatrix.h.

template<typename T >
void CRMatrix< T >::MatVecMult ( Vector< T > &  res,
const Vector< T > &  v 
) const

Definition at line 519 of file crmatrix.h.

References BCHKNR, i, res, TVector< T >::size(), T, and v.

Referenced by MatVecMult().

template<typename T >
void CRMatrix< T >::MatVecMult ( T v,
T res 
)

Definition at line 536 of file crmatrix.h.

References i, and T.

template<typename T >
CRMatrix< T > CRMatrix< T >::mult ( const T z) const

Definition at line 597 of file crmatrix.h.

References CRMatrix< T >::comp, i, and res.

Referenced by operator*().

template<typename T>
bool CRMatrix< T >::operator!= ( const CRMatrix< T > &  m) const
inline

Definition at line 128 of file crmatrix.h.

References CRMatrix< T >::operator==().

template<typename T >
const T & CRMatrix< T >::operator() ( unsigned int  row,
unsigned int  column 
) const
inline

element access (read)

Definition at line 181 of file crmatrix.h.

References BCHK, index, and T.

template<typename T>
T& CRMatrix< T >::operator() ( unsigned int  row,
unsigned int  column 
)
inline

Definition at line 106 of file crmatrix.h.

References CRMatrix< T >::setval().

template<typename T >
TVector< T > CRMatrix< T >::operator* ( const Vector< T > &  v) const

Definition at line 479 of file crmatrix.h.

References BCHK, i, res, TVector< T >::set(), TVector< T >::size(), T, and v.

template<typename T >
TVector< T > CRMatrix< T >::operator* ( const TVector< T > &  tv) const
inline

Definition at line 494 of file crmatrix.h.

References v.

template<typename T >
TVector< T > CRMatrix< T >::operator* ( TSVector< T > &  tsv) const
inline
template<typename T >
CRMatrix< T > CRMatrix< T >::operator* ( const T z) const

Definition at line 585 of file crmatrix.h.

References CRMatrix< T >::comp, i, and res.

template<typename T >
CRMatrix< T > & CRMatrix< T >::operator*= ( const T z)

Definition at line 614 of file crmatrix.h.

References i.

template<typename T >
CRMatrix< T > CRMatrix< T >::operator- ( ) const

Definition at line 466 of file crmatrix.h.

References i, res, CRMatrix< T >::setval(), and T.

template<typename T >
CRMatrix< T > CRMatrix< T >::operator/ ( const T z) const

Definition at line 624 of file crmatrix.h.

References CRMatrix< T >::comp, i, and res.

template<typename T >
CRMatrix< T > & CRMatrix< T >::operator/= ( const T z)

Definition at line 636 of file crmatrix.h.

References i.

template<typename T >
CRMatrix< T > & CRMatrix< T >::operator= ( const CRMatrix< T > &  m)
template<typename T >
bool CRMatrix< T >::operator== ( const CRMatrix< T > &  m) const

Definition at line 452 of file crmatrix.h.

References i, CRMatrix< T >::n_cols, and CRMatrix< T >::n_rows.

Referenced by CRMatrix< T >::operator!=().

template<typename T >
void CRMatrix< T >::resize ( unsigned int  newRows,
unsigned int  newColumns 
)
inline

Definition at line 205 of file crmatrix.h.

template<typename T>
unsigned int CRMatrix< T >::rows ( ) const
inline

Definition at line 118 of file crmatrix.h.

References CRMatrix< T >::n_rows.

Referenced by operator<<().

template<typename T >
void CRMatrix< T >::set_row ( const Vector< T > &  v,
unsigned int  row 
)

Definition at line 323 of file crmatrix.h.

References BCHKNR, index, NULL, TVector< T >::size(), T, and v.

template<typename T >
void CRMatrix< T >::set_row ( const TVector< T > &  tv,
unsigned int  row 
)

Definition at line 361 of file crmatrix.h.

References v.

template<typename T >
void CRMatrix< T >::set_row ( const TSVector< T > &  tsv,
unsigned int  row 
)

Definition at line 368 of file crmatrix.h.

References v.

template<typename T >
void CRMatrix< T >::set_row ( T value,
unsigned int  row,
unsigned int  count,
unsigned int *  index 
)

Definition at line 377 of file crmatrix.h.

References BCHKNR, NULL, and T.

template<typename T >
CRMatrix< T > & CRMatrix< T >::setunit ( const T val = (T)1)
inline

set CSCMatrix to val times the unit matrix

Definition at line 729 of file crmatrix.h.

References BCHK, and i.

template<typename T >
CRMatrix< T > & CRMatrix< T >::setval ( const T z,
unsigned int  row,
unsigned int  column 
)

element access (write)

Definition at line 215 of file crmatrix.h.

References BCHK, i, index, NULL, T, and z.

Referenced by CRMatrix< T >::operator()(), and CRMatrix< T >::operator-().

template<typename T >
T & CRMatrix< T >::setval ( unsigned int  row,
unsigned int  column 
)

Definition at line 261 of file crmatrix.h.

References BCHK, i, NULL, and T.

template<typename T >
unsigned int CRMatrix< T >::size ( ) const

Definition at line 193 of file crmatrix.h.

References i.

Referenced by TSVector< T >::add_t_tsv(), and TSVector< T >::sub_t_tsv().

template<typename T >
CRMatrix< T > & CRMatrix< T >::swap ( CRMatrix< T > &  m)
template<typename T >
TVector< T > CRMatrix< T >::transMult ( const Vector< T > &  v) const

Definition at line 550 of file crmatrix.h.

References BCHK, i, res, TVector< T >::setval(), TVector< T >::size(), and v.

template<typename T >
TVector< T > CRMatrix< T >::transMult ( const TVector< T > &  tv) const

Definition at line 568 of file crmatrix.h.

References v.

template<typename T >
TVector< T > CRMatrix< T >::transMult ( const TSVector< T > &  tsv) const

Definition at line 576 of file crmatrix.h.

References v.

template<typename T >
CRMatrix< T > & CRMatrix< T >::transpose ( )
inline

Definition at line 758 of file crmatrix.h.

template<typename T >
CRMatrix< T > CRMatrix< T >::transposed_copy ( ) const

Inefficient! Use transMult if possible.

Definition at line 748 of file crmatrix.h.

References c.

Referenced by transpose().

Friends And Related Function Documentation

template<typename T>
STD__ ostream& operator<< FGD ( STD__ ostream &  stream,
const CRMatrix< T > &  m 
)
friend

Member Data Documentation

template<typename T>
unsigned int** CRMatrix< T >::colIndex
protected

Definition at line 68 of file crmatrix.h.

Referenced by CRMatrix< T >::copy(), CRMatrix< T >::operator=(), and CRMatrix< T >::swap().

template<typename T>
T** CRMatrix< T >::comp
protected
template<typename T>
T CRMatrix< T >::dummy
mutableprotected

Definition at line 70 of file crmatrix.h.

template<typename T>
unsigned int CRMatrix< T >::n_cols
protected
template<typename T>
unsigned int CRMatrix< T >::n_rows
protected
template<typename T>
unsigned int* CRMatrix< T >::rowSize
protected

Definition at line 67 of file crmatrix.h.

Referenced by CRMatrix< T >::copy(), CRMatrix< T >::operator=(), and CRMatrix< T >::swap().


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