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
CSCMatrix< T > Class Template Reference

exception class: Use MatErr from matrix.h More...

#include <cscmatrix.h>

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

 CSCMatrix ()
 constructors More...
 
 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 More...
 
unsigned int rows () const
 query matrix dimensions More...
 
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 More...
 
CSCMatrix< T > & clear ()
 set all elements defined to zero More...
 
CSCMatrix< T > & fill (const T &)
 set all defined element to a val More...
 
CSCMatrix< T > & setunit (const T &=(T) 1)
 set CSCMatrix to val times the unit matrix More...
 
tbci_traits< T >::const_refval_type operator() (unsigned int row, unsigned int column) const HOT
 element access (read) More...
 
tbci_traits< T >::const_refval_type get (unsigned int row, unsigned int column) const HOT
 element access (read) More...
 
CSCMatrix< T > & setval (const T &z, unsigned int row, unsigned int column)
 element access (write) More...
 
Tsetval (unsigned int row, unsigned int column)
 element access (write) More...
 
Toperator() (unsigned int row, unsigned int column)
 
TdataPointer ()
 
unsigned int * columnPointer ()
 
unsigned int * rowIndexPointer ()
 
bool operator== (const CSCMatrix< T > &m) const
 matrix-matrix assignment and comparison More...
 
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. More...
 
template<typename MatType >
void do_export (MatType &M)
 Export operation. More...
 
CSCMatrix< Toperator- () const
 matrix negation More...
 
CSCMatrix< Toperator+ (const CSCMatrix< T > &) const
 Addition. More...
 
CSCMatrix< Toperator- (const CSCMatrix< T > &) const
 
F_TMatrix< Toperator* (const CSCMatrix< T > &) const
 CSCMatrix * CSCMatrix. More...
 
F_TMatrix< Tmultf (const F_Matrix< T > &) const
 matrix-matrix multiplication More...
 
F_TMatrix< Tmult (const F_Matrix< T > &) const
 Calculate *this * m1 (dumb version) More...
 
F_TMatrix< Tmult1 (const F_Matrix< T > &) const
 Calculate *this * m1 (smart version) More...
 
TVector< Toperator* (const Vector< T > &v) const HOT
 matrix - vector multiplication More...
 
TVector< Toperator* (const TVector< T > &tv) const HOT
 
TVector< Toperator* (TSVector< T > &tsv) const HOT
 
TVector< Tcscm_vec_mul_exact (const Vector< T > &V) const
 
void MatVecMult (Vector< T > &res, const Vector< T > &v) const HOT
 for friend void MatVecMult FGD (Vector<T>& res, const CSCMatrix<T>& m, const Vector<T>& v); More...
 
void MatVecMult (T *v, T *res) HOT
 
TVector< TtransMult (const Vector< T > &v) const HOT
 transpose-vector multiplication More...
 
TVector< TtransMult (const TVector< T > &tv) const HOT
 
TVector< TtransMult (const TSVector< T > &tsv) const HOT
 
CSCMatrix< Toperator* (const T &z) const
 
CSCMatrix< Tmult (const T &) const
 for friend CSCMatrix<T> operator* FGD (const T& z, const CSCMatrix<T>& m); More...
 
CSCMatrix< T > & operator*= (const T &z)
 
CSCMatrix< Toperator/ (const T &z) const
 
CSCMatrix< T > & operator/= (const T &z)
 
CSCMatrix< T > & swap (CSCMatrix< T > &)
 
CSCMatrix< Ttransposed_copy () const
 Inefficient! Use transMult if possible. More...
 
CSCMatrix< 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 ()
 allow instantiation (Matrix_Sig) More...
 
- 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, 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. More...
 

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]. More...
 
unsigned int n_cols
 
unsigned int n_size
 
unsigned int n_max_size
 
unsigned int * pcol
 
unsigned int * irow
 
Tcomp
 
T dummy
 

Friends

class F_TSMatrix< T >
 
STD__ ostream & operator<< FGDT (STD__ ostream &stream, const CSCMatrix< T > &m)
 Output operations. More...
 

Detailed Description

template<typename T>
class CSCMatrix< T >

exception class: Use MatErr from matrix.h

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

Alternative: BdMatrix.

Definition at line 49 of file cscmatrix.h.

Member Typedef Documentation

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

Definition at line 71 of file cscmatrix.h.

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

Definition at line 72 of file cscmatrix.h.

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

Definition at line 70 of file cscmatrix.h.

Constructor & Destructor Documentation

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

constructors

Definition at line 75 of file cscmatrix.h.

References CSCMatrix< T >::allocate().

template<typename T>
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 CSCMatrix< T >::allocate(), CSCMatrix< T >::fill(), and T.

template<typename T>
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.

References CSCMatrix< T >::allocate().

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

Definition at line 83 of file cscmatrix.h.

References CSCMatrix< T >::copy().

template<typename T>
CSCMatrix< T >::CSCMatrix ( const F_Matrix< T > &  m,
const double  tol = 0 
)
inline
template<typename T>
CSCMatrix< T >::CSCMatrix ( const BdMatrix< T > &  m,
const double  tol = 0 
)
inline
template<typename T>
CSCMatrix< T >::CSCMatrix ( const Matrix< T > &  m,
const double  tol = 0 
)
inline
template<typename T>
CSCMatrix< T >::~CSCMatrix ( )
inline

Definition at line 91 of file cscmatrix.h.

References CSCMatrix< T >::destroy().

Member Function Documentation

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

set all elements defined to zero

Definition at line 1012 of file cscmatrix.h.

References CSTD__, and T.

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

Definition at line 130 of file cscmatrix.h.

References CSCMatrix< T >::pcol.

Referenced by lu_solve().

template<typename T>
unsigned int CSCMatrix< T >::columns ( ) const
inline
template<typename T >
void CSCMatrix< T >::copy ( const CSCMatrix< T > &  m)
protected
template<typename T >
TVector< T > CSCMatrix< T >::cscm_vec_mul_exact ( const Vector< T > &  V) const

Definition at line 733 of file cscmatrix.h.

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

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

Definition at line 129 of file cscmatrix.h.

References CSCMatrix< T >::comp.

Referenced by lu_solve().

template<typename T >
void CSCMatrix< T >::destroy ( )
protected

Definition at line 956 of file cscmatrix.h.

References NULL.

Referenced by CSCMatrix< T >::do_import(), and CSCMatrix< T >::~CSCMatrix().

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

Export operation.

Definition at line 152 of file cscmatrix.h.

References CSCMatrix< T >::comp, i, CSCMatrix< T >::irow, CSCMatrix< T >::n_cols, and CSCMatrix< T >::pcol.

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

Import operation, automatic conversion to sparse matrix.

Definition at line 142 of file cscmatrix.h.

References CSCMatrix< T >::allocate(), CSCMatrix< T >::destroy(), and CSCMatrix< T >::fill().

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

set all defined element to a val

Definition at line 998 of file cscmatrix.h.

References c, Matrix_Sig< T >::clear(), Matrix_Sig< T >::columns(), Matrix_Sig< T >::rows(), and T.

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

template<typename T>
template<typename MatType >
void CSCMatrix< T >::fill ( const MatType &  M,
const double  tol = 0.0 
)
inlineprotected

Import operation, automatic conversion to sparse matrix.

Definition at line 229 of file cscmatrix.h.

References std::fabs(), i, MATH__, CSCMatrix< T >::n_cols, CSCMatrix< T >::n_rows, CSCMatrix< T >::resize(), CSCMatrix< T >::setval(), and STD__.

template<typename T >
tbci_traits< T >::const_refval_type CSCMatrix< T >::get ( unsigned int  row,
unsigned int  column 
) const
inline

element access (read)

Definition at line 455 of file cscmatrix.h.

References TBCI::_bin_search(), F_TSMatrix< T >::col, REGISTER, and T.

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

Definition at line 591 of file cscmatrix.h.

References BCHKNR, i, NULL, T, and UNLIKELY.

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

allow instantiation (Matrix_Sig)

Definition at line 97 of file cscmatrix.h.

template<typename T >
void CSCMatrix< T >::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);

Definition at line 791 of file cscmatrix.h.

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

Referenced by MatVecMult().

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

Definition at line 809 of file cscmatrix.h.

References i, and STD__.

template<typename T >
F_TMatrix< T > CSCMatrix< T >::mult ( const F_Matrix< T > &  m1) const

Calculate *this * m1 (dumb version)

Definition at line 301 of file cscmatrix.h.

References BCHK, Matrix_Sig< T >::columns(), F_Matrix< T >::columns(), do_exactsum2(), i, REGISTER, res, Matrix_Sig< T >::rows(), F_Matrix< T >::rows(), T, x, and y.

Referenced by operator*().

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

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

Definition at line 882 of file cscmatrix.h.

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

template<typename T >
F_TMatrix< T > CSCMatrix< T >::mult1 ( const F_Matrix< T > &  m1) const

Calculate *this * m1 (smart version)

Definition at line 332 of file cscmatrix.h.

References BCHK, c, Matrix_Sig< T >::columns(), F_Matrix< T >::columns(), res, Matrix_Sig< T >::rows(), F_Matrix< T >::rows(), and T.

Referenced by operator*().

template<typename T >
F_TMatrix< T > CSCMatrix< T >::multf ( const F_Matrix< T > &  m1) const

matrix-matrix multiplication

Calculate m1 * *this.

Definition at line 265 of file cscmatrix.h.

References BCHK, Matrix_Sig< T >::columns(), F_Matrix< T >::columns(), do_exactsum2(), i, REGISTER, res, Matrix_Sig< T >::rows(), F_Matrix< T >::rows(), T, x, and y.

Referenced by operator*().

template<typename T >
CSCMatrix< T >::operator F_TMatrix< T > ( ) const

conversion to F_Matrix

Definition at line 549 of file cscmatrix.h.

References c, Matrix_Sig< T >::columns(), res, Matrix_Sig< T >::rows(), F_TMatrix< T >::setval(), and T.

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

Definition at line 135 of file cscmatrix.h.

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

template<typename T>
tbci_traits<T>::const_refval_type CSCMatrix< T >::operator() ( unsigned int  row,
unsigned int  column 
) const

element access (read)

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

Definition at line 127 of file cscmatrix.h.

References CSCMatrix< T >::setval().

template<typename T >
F_TMatrix< T > CSCMatrix< T >::operator* ( const CSCMatrix< T > &  m1) const
template<typename T >
TVector< T > CSCMatrix< T >::operator* ( const Vector< T > &  v) const

matrix - vector multiplication

Definition at line 752 of file cscmatrix.h.

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

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

Definition at line 767 of file cscmatrix.h.

References v.

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

Definition at line 871 of file cscmatrix.h.

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

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

Definition at line 898 of file cscmatrix.h.

References i.

template<typename T >
CSCMatrix< T > CSCMatrix< T >::operator+ ( const CSCMatrix< T > &  m1) const
template<typename T >
CSCMatrix< T > CSCMatrix< T >::operator- ( ) const

matrix negation

Definition at line 699 of file cscmatrix.h.

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

template<typename T >
CSCMatrix< T > CSCMatrix< T >::operator- ( const CSCMatrix< T > &  m1) const
template<typename T >
CSCMatrix< T > CSCMatrix< T >::operator/ ( const T z) const

Definition at line 907 of file cscmatrix.h.

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

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

Definition at line 918 of file cscmatrix.h.

References i.

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

Definition at line 672 of file cscmatrix.h.

References F_TSMatrix< T >::destroy().

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

matrix-matrix assignment and comparison

Definition at line 683 of file cscmatrix.h.

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

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

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

change matrix dimensions

Definition at line 561 of file cscmatrix.h.

References F_TSMatrix< T >::destroy(), i, MIN, T, and UNLIKELY.

Referenced by CSCMatrix< T >::fill().

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

Definition at line 131 of file cscmatrix.h.

References CSCMatrix< T >::irow.

Referenced by lu_solve().

template<typename T>
unsigned int CSCMatrix< T >::rows ( ) const
inline
template<typename T >
CSCMatrix< T > & CSCMatrix< T >::setunit ( const T val = (T)1)

set CSCMatrix to val times the unit matrix

Definition at line 1016 of file cscmatrix.h.

References BCHK, Matrix_Sig< T >::clear(), i, and Matrix_Sig< T >::setunit().

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

element access (write)

Definition at line 640 of file cscmatrix.h.

References z.

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

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

element access (write)

Definition at line 648 of file cscmatrix.h.

References F_TSMatrix< T >::col, EXPCHKNR, index, F_TSMatrix< T >::row, and T.

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

Definition at line 103 of file cscmatrix.h.

References CSCMatrix< T >::n_size.

Referenced by lu_solve().

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

transpose-vector multiplication

Definition at line 826 of file cscmatrix.h.

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

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

Definition at line 854 of file cscmatrix.h.

References Matrix_Sig< T >::transMult(), and v.

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

Definition at line 862 of file cscmatrix.h.

References Matrix_Sig< T >::transMult(), and v.

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

Definition at line 1047 of file cscmatrix.h.

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

Inefficient! Use transMult if possible.

Definition at line 1037 of file cscmatrix.h.

References c, Matrix_Sig< T >::columns(), and Matrix_Sig< T >::rows().

Referenced by transpose().

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<< FGDT ( STD__ ostream &  stream,
const CSCMatrix< T > &  m 
)
friend

Output operations.

Member Data Documentation

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

Definition at line 219 of file cscmatrix.h.

template<typename T>
unsigned int* CSCMatrix< T >::irow
protected
template<typename T>
unsigned int CSCMatrix< T >::n_cols
protected
template<typename T>
unsigned int CSCMatrix< T >::n_max_size
protected

Definition at line 215 of file cscmatrix.h.

Referenced by CSCMatrix< T >::swap().

template<typename T>
unsigned int 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 215 of file cscmatrix.h.

Referenced by CSCMatrix< T >::copy(), CSCMatrix< T >::fill(), CSCMatrix< T >::operator==(), CSCMatrix< T >::rows(), and CSCMatrix< T >::swap().

template<typename T>
unsigned int CSCMatrix< T >::n_size
protected

Definition at line 215 of file cscmatrix.h.

Referenced by CSCMatrix< T >::copy(), CSCMatrix< T >::size(), and CSCMatrix< T >::swap().

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

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