TBCI::CSCMatrix< T > Class Template Reference

#include <cscmatrix.h>

Inheritance diagram for TBCI::CSCMatrix< T >:

Inheritance graph
[legend]
Collaboration diagram for TBCI::CSCMatrix< 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

 CSCMatrix ()
 constructors
 CSCMatrix (const T &val, const unsigned int rows, const unsigned int columns, const unsigned int nnzeros=1)
 CSCMatrix (const unsigned int rows, const unsigned int columns, const unsigned int nnzeros=1)
 CSCMatrix (const CSCMatrix< T > &m)
 CSCMatrix (const F_Matrix< T > &m, const double tol=0)
 CSCMatrix (const BdMatrix< T > &m, const double tol=0)
 CSCMatrix (const Matrix< T > &m, const double tol=0)
 ~CSCMatrix ()
 operator F_TMatrix< T > () const
 conversion to F_Matrix
unsigned int rows () const
 query matrix dimensions
unsigned int columns () const
unsigned int size () const
CSCMatrix< T > & resize (const unsigned int newRows, const unsigned int newColumns, const unsigned int nnzeros=1)
 change matrix dimensions
CSCMatrix< T > & clear ()
 set all elements defined to zero
CSCMatrix< T > & fill (const T &)
 set all defined element to a val
CSCMatrix< 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
CSCMatrix< T > & setval (const T &z, unsigned int row, unsigned int column)
 element access (write)
T & setval (unsigned int row, unsigned int column)
 element access (write)
T & operator() (unsigned int row, unsigned int column)
T * dataPointer ()
unsigned int * columnPointer ()
unsigned int * rowIndexPointer ()
bool operator== (const CSCMatrix< T > &m) const
 matrix-matrix assignment and comparison
bool operator!= (const CSCMatrix< T > &m) const
CSCMatrix< T > & operator= (const CSCMatrix< T > &m)
template<typename MatType>
CSCMatrix< T > & do_import (const MatType &M)
 Import operation, automatic conversion to sparse matrix.
template<typename MatType>
void do_export (MatType &M)
 Export operation.
CSCMatrix< T > operator- () const
 matrix negation
CSCMatrix< T > operator+ (const CSCMatrix< T > &) const
 + and -
CSCMatrix< T > operator- (const CSCMatrix< T > &) const
F_TMatrix< T > operator* (const CSCMatrix< T > &) const
 CSCMatrix * CSCMatrix.
F_TMatrix< T > multf (const F_Matrix< T > &) const
 matrix-matrix multiplication
F_TMatrix< T > mult (const F_Matrix< T > &) const
 Calculate *this * m1 (dumb version).
F_TMatrix< T > mult1 (const F_Matrix< T > &) const
 Calculate *this * m1 (smart version).
TVector< T > operator* (const Vector< T > &v) const
 matrix - vector multiplication
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
 for friend void MatVecMult FGD (Vector<T>& res, const CSCMatrix<T>& m, const Vector<T>& v);
void MatVecMult (T *v, T *res)
TVector< T > transMult (const Vector< T > &v) const
 transpose-vector multiplication
TVector< T > transMult (const TVector< T > &tv) const
TVector< T > transMult (const TSVector< T > &tsv) const
CSCMatrix< T > operator* (const T &z) const
CSCMatrix< T > mult (const T &) const
 for friend CSCMatrix<T> operator* FGD (const T& z, const CSCMatrix<T>& m);
CSCMatrix< T > & operator*= (const T &z)
CSCMatrix< T > operator/ (const T &z) const
CSCMatrix< T > & operator/= (const T &z)
CSCMatrix< T > & swap (CSCMatrix< T > &)
CSCMatrix< T > transposed_copy () const
 Inefficient! Use transMult if possible.
CSCMatrix< T > & transpose ()

Static Public Member Functions

static const char * mat_info ()
 allow instantiation (Matrix_Sig)

Protected Member Functions

void allocate (unsigned int rows, unsigned int columns, unsigned int nnzeros=1)
void destroy ()
void copy (const CSCMatrix< T > &m)
void insert (const unsigned int column, const unsigned int pos)
template<typename MatType>
void fill (const MatType &M, const double tol=0.0)
 Import operation, automatic conversion to sparse matrix.

Protected Attributes

unsigned int n_rows
 Storage format: pcol holds the offsets of each column; the length of the column c is pcol[c+1]-pcol[c].
unsigned int n_cols
unsigned int n_size
unsigned int n_max_size
unsigned int * pcol
unsigned int * irow
T * comp
dummy

Friends

class F_TSMatrix< T >
std::ostream & operator (std::ostream &stream, const CSCMatrix< T > &m)
 Output operations.


Detailed Description

template<typename T>
class TBCI::CSCMatrix< T >

C++ class for sparse matrices; using compressed column storage, SuperLU compatible (NO FORTRAN NEEDED!!) Performs very well.

Alternative: BdMatrix.

Definition at line 65 of file cscmatrix.h.


Member Typedef Documentation

template<typename T>
typedef T TBCI::CSCMatrix< T >::value_type

Definition at line 70 of file cscmatrix.h.

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

Definition at line 71 of file cscmatrix.h.

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

Definition at line 72 of file cscmatrix.h.


Constructor & Destructor Documentation

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

constructors

Definition at line 75 of file cscmatrix.h.

template<typename T>
TBCI::CSCMatrix< T >::CSCMatrix ( const T &  val,
const unsigned int  rows,
const unsigned int  columns,
const unsigned int  nnzeros = 1 
) [inline]

Definition at line 76 of file cscmatrix.h.

References T.

template<typename T>
TBCI::CSCMatrix< T >::CSCMatrix ( const unsigned int  rows,
const unsigned int  columns,
const unsigned int  nnzeros = 1 
) [inline]

Definition at line 80 of file cscmatrix.h.

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

Definition at line 83 of file cscmatrix.h.

template<typename T>
TBCI::CSCMatrix< T >::CSCMatrix ( const F_Matrix< T > &  m,
const double  tol = 0 
) [inline]

Definition at line 85 of file cscmatrix.h.

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

template<typename T>
TBCI::CSCMatrix< T >::CSCMatrix ( const BdMatrix< T > &  m,
const double  tol = 0 
) [inline]

Definition at line 87 of file cscmatrix.h.

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

template<typename T>
TBCI::CSCMatrix< T >::CSCMatrix ( const Matrix< T > &  m,
const double  tol = 0 
) [inline]

Definition at line 89 of file cscmatrix.h.

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

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

Definition at line 91 of file cscmatrix.h.


Member Function Documentation

template<typename T>
TBCI::CSCMatrix< T >::operator F_TMatrix< T > (  )  const [inline]

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

allow instantiation (Matrix_Sig)

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 97 of file cscmatrix.h.

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

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

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

template<typename T>
CSCMatrix< T > & TBCI::CSCMatrix< T >::resize ( const unsigned int  newRows,
const unsigned int  newColumns,
const unsigned int  nnzeros = 1 
) [inline]

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

set all elements defined to zero

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 867 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::comp, CSTD__, TBCI::CSCMatrix< T >::n_size, and T.

Referenced by TBCI::CSCMatrix< T >::fill(), and TBCI::CSCMatrix< T >::setunit().

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

set all defined element to a val

Reimplemented from TBCI::Matrix_Sig< T >.

Definition at line 853 of file cscmatrix.h.

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

template<typename T>
CSCMatrix< T > & TBCI::CSCMatrix< 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 871 of file cscmatrix.h.

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

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

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

Definition at line 125 of file cscmatrix.h.

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

element access (write)

Definition at line 557 of file cscmatrix.h.

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

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

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

Definition at line 131 of file cscmatrix.h.

template<typename T>
T* TBCI::CSCMatrix< T >::dataPointer (  )  [inline]

Definition at line 133 of file cscmatrix.h.

Referenced by TBCI::lu_solve().

template<typename T>
unsigned int* TBCI::CSCMatrix< T >::columnPointer (  )  [inline]

Definition at line 134 of file cscmatrix.h.

Referenced by TBCI::lu_solve().

template<typename T>
unsigned int* TBCI::CSCMatrix< T >::rowIndexPointer (  )  [inline]

Definition at line 135 of file cscmatrix.h.

Referenced by TBCI::lu_solve().

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

matrix-matrix assignment and comparison

Definition at line 600 of file cscmatrix.h.

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

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

Definition at line 139 of file cscmatrix.h.

References TBCI::operator==().

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

Definition at line 589 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::copy(), and TBCI::CSCMatrix< T >::destroy().

template<typename T>
template<typename MatType>
CSCMatrix<T>& TBCI::CSCMatrix< T >::do_import ( const MatType &  M  )  [inline]

Import operation, automatic conversion to sparse matrix.

Definition at line 146 of file cscmatrix.h.

template<typename T>
template<typename MatType>
void TBCI::CSCMatrix< T >::do_export ( MatType &  M  )  [inline]

Export operation.

Definition at line 156 of file cscmatrix.h.

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

template<typename T>
CSCMatrix< T > TBCI::CSCMatrix< T >::operator+ ( const CSCMatrix< T > &  m1  )  const [inline]

template<typename T>
CSCMatrix< T > TBCI::CSCMatrix< T >::operator- ( const CSCMatrix< T > &  m1  )  const [inline]

template<typename T>
F_TMatrix< T > TBCI::CSCMatrix< T >::operator* ( const CSCMatrix< T > &  m1  )  const [inline]

template<typename T>
F_TMatrix< T > TBCI::CSCMatrix< T >::multf ( const F_Matrix< T > &  m1  )  const [inline]

template<typename T>
F_TMatrix< T > TBCI::CSCMatrix< T >::mult ( const F_Matrix< T > &  m1  )  const [inline]

template<typename T>
F_TMatrix< T > TBCI::CSCMatrix< T >::mult1 ( const F_Matrix< T > &  m1  )  const [inline]

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

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

Definition at line 639 of file cscmatrix.h.

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

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

for friend void MatVecMult FGD (Vector<T>& res, const CSCMatrix<T>& m, const Vector<T>& v);

Definition at line 661 of file cscmatrix.h.

References BCHKNR, TBCI::CSCMatrix< T >::comp, TBCI::CSCMatrix< T >::irow, TBCI::CSCMatrix< T >::n_cols, TBCI::CSCMatrix< T >::pcol, TBCI::TVector< T >::size(), and T.

Referenced by TBCI::MatVecMult().

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

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

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

Definition at line 709 of file cscmatrix.h.

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

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

Definition at line 717 of file cscmatrix.h.

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

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

Definition at line 726 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::comp, and TBCI::CSCMatrix< T >::n_size.

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

for friend CSCMatrix<T> operator* FGD (const T& z, const CSCMatrix<T>& m);

Definition at line 737 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::comp, and TBCI::CSCMatrix< T >::n_size.

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

Definition at line 753 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::comp, and TBCI::CSCMatrix< T >::n_size.

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

Definition at line 762 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::comp, and TBCI::CSCMatrix< T >::n_size.

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

Definition at line 773 of file cscmatrix.h.

References TBCI::CSCMatrix< T >::comp, and TBCI::CSCMatrix< T >::n_size.

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

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

Inefficient! Use transMult if possible.

Definition at line 892 of file cscmatrix.h.

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

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

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

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

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

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

template<typename T>
void TBCI::CSCMatrix< T >::insert ( const unsigned int  column,
const unsigned int  pos 
) [inline, protected]

template<typename T>
template<typename MatType>
void TBCI::CSCMatrix< T >::fill ( const MatType &  M,
const double  tol = 0.0 
) [inline, protected]

Import operation, automatic conversion to sparse matrix.

Definition at line 232 of file cscmatrix.h.

References std::fabs(), MATH__, and STD__.


Friends And Related Function Documentation

template<typename T>
friend class F_TSMatrix< T > [friend]

Definition at line 67 of file cscmatrix.h.

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

Output operations.


Member Data Documentation

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

Storage format: pcol holds the offsets of each column; the length of the column c is pcol[c+1]-pcol[c].

The elements located at comp[i] with pos[c] <= i < pos[c+1] are representing the matrix elements m(irow[i], c)

Definition at line 218 of file cscmatrix.h.

Referenced by TBCI::CSCMatrix< T >::allocate(), TBCI::CSCMatrix< T >::copy(), TBCI::CSCMatrix< T >::operator()(), TBCI::CSCMatrix< T >::operator*(), TBCI::CSCMatrix< T >::operator-(), TBCI::CSCMatrix< T >::operator==(), TBCI::CSCMatrix< T >::resize(), TBCI::CSCMatrix< T >::setunit(), TBCI::CSCMatrix< T >::setval(), TBCI::CSCMatrix< T >::swap(), and TBCI::CSCMatrix< T >::transMult().

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

template<typename T>
unsigned int TBCI::CSCMatrix< T >::n_size [protected]

template<typename T>
unsigned int TBCI::CSCMatrix< T >::n_max_size [protected]

template<typename T>
unsigned int* TBCI::CSCMatrix< T >::pcol [protected]

template<typename T>
unsigned int* TBCI::CSCMatrix< T >::irow [protected]

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

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

Definition at line 222 of file cscmatrix.h.

Referenced by TBCI::CSCMatrix< T >::operator()().


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

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