TBCI::CRMatrix< T > Class Template Reference

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

#include <crmatrix.h>

Inheritance diagram for TBCI::CRMatrix< T >:

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

Collaboration graph
[legend]

List of all members.

Public Types

typedef T value_type
typedef T element_type
typedef T aligned_value_type

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
CRMatrix< T > & fill (const T &)
 set all defined element to a val
CRMatrix< T > & setunit (const T &=(T) 1)
 set CSCMatrix to val times the unit matrix
const T & operator() (unsigned int row, unsigned int column) const
 element access (read)
const T & get (unsigned int row, unsigned int column) const
CRMatrix< T > & setval (const T &z, unsigned int row, unsigned int column)
 element access (write)
T & setval (unsigned int row, unsigned int column)
T & operator() (unsigned int row, unsigned int column)
TVector< T > get_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< T > operator- () const
TVector< T > operator* (const Vector< T > &v) const
TVector< T > operator* (const TVector< T > &tv) const
TVector< T > operator* (TSVector< T > &tsv) const
void MatVecMult (Vector< T > &res, const Vector< T > &v) const
void MatVecMult (T *v, T *res)
TVector< T > transMult (const Vector< T > &v) const
TVector< T > transMult (const TVector< T > &tv) const
TVector< T > transMult (const TSVector< T > &tsv) const
CRMatrix< T > operator* (const T &z) const
CRMatrix< T > & operator*= (const T &z)
CRMatrix< T > operator/ (const T &z) const
CRMatrix< T > & operator/= (const T &z)
CRMatrix< T > mult (const T &z) const
CRMatrix< T > & swap (CRMatrix< T > &)
CRMatrix< T > transposed_copy () const
 Inefficient! Use transMult if possible.
CRMatrix< T > & transpose ()

Static Public Member Functions

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
dummy

Friends

std::ostream & operator<< (std::ostream &stream, const CRMatrix< T > &m)


Detailed Description

template<typename T>
class TBCI::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 TBCI::CRMatrix< T >::value_type

Definition at line 79 of file crmatrix.h.

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

Definition at line 80 of file crmatrix.h.

template<typename T>
typedef T TBCI::CRMatrix< T >::aligned_value_type

Definition at line 81 of file crmatrix.h.


Constructor & Destructor Documentation

template<typename T>
TBCI::CRMatrix< T >::CRMatrix (  )  [inline]

Definition at line 83 of file crmatrix.h.

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

Definition at line 84 of file crmatrix.h.

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

Definition at line 85 of file crmatrix.h.

template<typename T>
TBCI::CRMatrix< T >::CRMatrix ( const Matrix< T > &  mat  )  [inline]

template<typename T>
TBCI::CRMatrix< T >::~CRMatrix (  )  [inline]

Definition at line 87 of file crmatrix.h.


Member Function Documentation

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

template<typename T>
void TBCI::CRMatrix< T >::destroy (  )  [inline, protected]

template<typename T>
void TBCI::CRMatrix< T >::copy ( const CRMatrix< T > &  m  )  [inline, protected]

template<typename T>
static const char* TBCI::CRMatrix< T >::mat_info (  )  [inline, static]

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 90 of file crmatrix.h.

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

set all elements defined to zero

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 725 of file crmatrix.h.

References TBCI::CRMatrix< T >::fill(), and T.

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

template<typename T>
CRMatrix< T > & TBCI::CRMatrix< T >::fill ( const T &  val  )  [inline]

set all defined element to a val

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 716 of file crmatrix.h.

References TBCI::CRMatrix< T >::comp, TBCI::CRMatrix< T >::n_rows, and TBCI::CRMatrix< T >::rowSize.

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

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

set CSCMatrix to val times the unit matrix

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 729 of file crmatrix.h.

References BCHK, TBCI::CRMatrix< T >::clear(), TBCI::CRMatrix< T >::n_cols, TBCI::CRMatrix< T >::n_rows, and TBCI::CRMatrix< T >::setval().

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

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

Definition at line 101 of file crmatrix.h.

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

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

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

Definition at line 106 of file crmatrix.h.

template<typename T>
TVector< T > TBCI::CRMatrix< T >::get_row ( unsigned int  row  )  const [inline]

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

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

Definition at line 361 of file crmatrix.h.

References TBCI::CRMatrix< T >::set_row().

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

Definition at line 368 of file crmatrix.h.

References TBCI::CRMatrix< T >::set_row().

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

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

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 118 of file crmatrix.h.

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

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

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 119 of file crmatrix.h.

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

template<typename T>
unsigned int TBCI::CRMatrix< T >::size (  )  const [inline]

Definition at line 193 of file crmatrix.h.

References TBCI::CRMatrix< T >::n_rows, and TBCI::CRMatrix< T >::rowSize.

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

template<typename T>
CRMatrix< T > & TBCI::CRMatrix< T >::operator= ( const CRMatrix< T > &  m  )  [inline]

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

Definition at line 452 of file crmatrix.h.

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

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

Definition at line 128 of file crmatrix.h.

References TBCI::operator==().

template<typename T>
CRMatrix< T > TBCI::CRMatrix< T >::operator- (  )  const [inline]

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

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

Definition at line 494 of file crmatrix.h.

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

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

template<typename T>
void TBCI::CRMatrix< T >::MatVecMult ( T *  v,
T *  res 
) [inline]

template<typename T>
TVector< T > TBCI::CRMatrix< T >::transMult ( const Vector< T > &  v  )  const [inline]

template<typename T>
TVector< T > TBCI::CRMatrix< T >::transMult ( const TVector< T > &  tv  )  const [inline]

Definition at line 568 of file crmatrix.h.

References TBCI::CRMatrix< T >::transMult().

template<typename T>
TVector< T > TBCI::CRMatrix< T >::transMult ( const TSVector< T > &  tsv  )  const [inline]

Definition at line 576 of file crmatrix.h.

References TBCI::CRMatrix< T >::transMult().

template<typename T>
CRMatrix< T > TBCI::CRMatrix< T >::operator* ( const T &  z  )  const [inline]

template<typename T>
CRMatrix< T > & TBCI::CRMatrix< T >::operator*= ( const T &  z  )  [inline]

template<typename T>
CRMatrix< T > TBCI::CRMatrix< T >::operator/ ( const T &  z  )  const [inline]

template<typename T>
CRMatrix< T > & TBCI::CRMatrix< T >::operator/= ( const T &  z  )  [inline]

template<typename T>
CRMatrix< T > TBCI::CRMatrix< T >::mult ( const T &  z  )  const [inline]

template<typename T>
CRMatrix< T > & TBCI::CRMatrix< T >::swap ( CRMatrix< T > &  m  )  [inline]

template<typename T>
CRMatrix< T > TBCI::CRMatrix< T >::transposed_copy (  )  const [inline]

Inefficient! Use transMult if possible.

Definition at line 748 of file crmatrix.h.

References TBCI::CRMatrix< T >::columns(), and TBCI::CRMatrix< T >::rows().

Referenced by TBCI::transpose(), and TBCI::CRMatrix< T >::transpose().

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


Friends And Related Function Documentation

template<typename T>
std:: ostream& operator<< ( std::ostream &  stream,
const CRMatrix< T > &  m 
) [friend]

Definition at line 773 of file crmatrix.h.


Member Data Documentation

template<typename T>
unsigned int TBCI::CRMatrix< T >::n_rows [protected]

template<typename T>
unsigned int TBCI::CRMatrix< T >::n_cols [protected]

template<typename T>
unsigned int* TBCI::CRMatrix< T >::rowSize [protected]

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

template<typename T>
T** TBCI::CRMatrix< T >::comp [protected]

template<typename T>
T TBCI::CRMatrix< T >::dummy [mutable, protected]


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

Generated on Wed Nov 20 09:29:20 2013 for TBCI Numerical high perf. C++ Library by  doxygen 1.5.6