List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends
utl::SparseMatrix< T > Class Template Reference

Sparse container class for matrix data. More...

#include "utl/SparseMatrix.h"

Classes

class  Index
 index class More...
 
class  IteratorTransformer
 iterator class More...
 
class  Row
 row proxy More...
 

Public Types

typedef IteratorTransformer
< MapConstIterator, const T > 
ConstIterator
 
typedef int IndexType
 
typedef IteratorTransformer
< MapIterator, T > 
Iterator
 

Public Member Functions

void Clear ()
 
Iterator Find (const IndexType row, const IndexType column)
 
ConstIterator Find (const IndexType row, const IndexType column) const
 
const T & GetInitializer () const
 
unsigned int GetNonEmptySize () const
 
bool IsEmpty () const
 
bool operator!= (const SparseMatrix &m) const
 be sure to call Reclaim() first More...
 
template<typename U >
bool operator!= (const SparseMatrix< U > &m) const
 
T & operator() (const IndexType row, const IndexType column)
 creational () access More...
 
const T & operator() (const IndexType row, const IndexType column) const
 noncreational () access for const More...
 
template<typename U >
SparseMatrixoperator*= (const U &value)
 multiplication with scalar More...
 
template<typename U >
SparseMatrixoperator+= (const SparseMatrix< U > &m)
 matrix addition More...
 
template<typename U >
SparseMatrixoperator-= (const SparseMatrix< U > &m)
 matrix subtraction More...
 
bool operator== (const SparseMatrix &m) const
 be sure to call Reclaim() first More...
 
template<typename U >
bool operator== (const SparseMatrix< U > &m) const
 
SparseMatrix::Row operator[] (const IndexType row) const
 noncreational [] access trough proxy More...
 
unsigned int Reclaim ()
 
Iterator SparseBegin ()
 
ConstIterator SparseBegin () const
 
Iterator SparseEnd ()
 
ConstIterator SparseEnd () const
 
void Transpose ()
 in-situ transpose More...
 

Public Attributes

 __pad0__: fInitializer(init) { } template<typename U> explicit SparseMatrix(const SparseMatrix<U>& m) : fInitializer(m.GetInitializer()) { for (typename SparseMatrix<U>::ConstIterator it = m.SparseBegin()
 
bool const
 
 it = m.SparseEnd()
 
return it == fMatrix.end()
 
it(* this )(it.GetRow(), it.GetColumn()) = it()
 

Private Types

typedef SparseMatrix< T >::Index IndexKeyType
 
typedef MapType::const_iterator MapConstIterator
 
typedef MapType::iterator MapIterator
 
typedef std::map< IndexKeyType, T > MapType
 
typedef MapType::value_type MapValueType
 

Private Member Functions

void Erase (const MapIterator it)
 

Private Attributes

constfInitializer
 
MapType fMatrix
 

Friends

template<typename U >
class SparseMatrix
 

Detailed Description

template<typename T = double>
class utl::SparseMatrix< T >

Sparse container class for matrix data.

Importatant notes:

Please refer to the testSparseMatrix.cc and test SparseMatrixVectorOps.cc files for detailed usage cases.

Author
Darko Veberic
Date
5 Jun 2008

Definition at line 36 of file SparseMatrix.h.

Member Typedef Documentation

template<typename T = double>
typedef IteratorTransformer<MapConstIterator, const T> utl::SparseMatrix< T >::ConstIterator

Definition at line 213 of file SparseMatrix.h.

template<typename T = double>
typedef SparseMatrix<T>::Index utl::SparseMatrix< T >::IndexKeyType
private

Definition at line 78 of file SparseMatrix.h.

template<typename T = double>
typedef int utl::SparseMatrix< T >::IndexType

Definition at line 38 of file SparseMatrix.h.

template<typename T = double>
typedef IteratorTransformer<MapIterator, T> utl::SparseMatrix< T >::Iterator

Definition at line 212 of file SparseMatrix.h.

template<typename T = double>
typedef MapType::const_iterator utl::SparseMatrix< T >::MapConstIterator
private

Definition at line 82 of file SparseMatrix.h.

template<typename T = double>
typedef MapType::iterator utl::SparseMatrix< T >::MapIterator
private

Definition at line 81 of file SparseMatrix.h.

template<typename T = double>
typedef std::map<IndexKeyType, T> utl::SparseMatrix< T >::MapType
private

Definition at line 79 of file SparseMatrix.h.

template<typename T = double>
typedef MapType::value_type utl::SparseMatrix< T >::MapValueType
private

Definition at line 80 of file SparseMatrix.h.

Member Function Documentation

template<typename T = double>
void utl::SparseMatrix< T >::Clear ( )
inline

Definition at line 127 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

template<typename T = double>
void utl::SparseMatrix< T >::Erase ( const MapIterator  it)
inlineprivate

Definition at line 274 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

Referenced by utl::SparseMatrix< T >::Reclaim().

template<typename T = double>
Iterator utl::SparseMatrix< T >::Find ( const IndexType  row,
const IndexType  column 
)
inline

Definition at line 223 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

Referenced by TestSparseMatrix::TestIterators().

template<typename T = double>
ConstIterator utl::SparseMatrix< T >::Find ( const IndexType  row,
const IndexType  column 
) const
inline

Definition at line 226 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

template<typename T = double>
const T& utl::SparseMatrix< T >::GetInitializer ( ) const
inline
template<typename T = double>
unsigned int utl::SparseMatrix< T >::GetNonEmptySize ( ) const
inline

Definition at line 123 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

Referenced by TestSparseMatrix::TestOperators().

template<typename T = double>
bool utl::SparseMatrix< T >::IsEmpty ( ) const
inline

Definition at line 152 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

Referenced by utl::OutputSparse().

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

be sure to call Reclaim() first

Definition at line 182 of file SparseMatrix.h.

References utl::SparseMatrix< T >::operator==().

template<typename T = double>
template<typename U >
bool utl::SparseMatrix< T >::operator!= ( const SparseMatrix< U > &  m) const
inline

Definition at line 210 of file SparseMatrix.h.

References utl::SparseMatrix< T >::operator==().

template<typename T = double>
T& utl::SparseMatrix< T >::operator() ( const IndexType  row,
const IndexType  column 
)
inline

creational () access

Definition at line 137 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fInitializer, and utl::SparseMatrix< T >::fMatrix.

template<typename T = double>
const T& utl::SparseMatrix< T >::operator() ( const IndexType  row,
const IndexType  column 
) const
inline

noncreational () access for const

Definition at line 145 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fInitializer, utl::SparseMatrix< T >::fMatrix, and utl::SparseMatrix< T >::it.

template<typename T = double>
template<typename U >
SparseMatrix& utl::SparseMatrix< T >::operator*= ( const U value)
inline

multiplication with scalar

Definition at line 232 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix, and utl::SparseMatrix< T >::it.

template<typename T = double>
template<typename U >
SparseMatrix& utl::SparseMatrix< T >::operator+= ( const SparseMatrix< U > &  m)
inline
template<typename T = double>
template<typename U >
SparseMatrix& utl::SparseMatrix< T >::operator-= ( const SparseMatrix< U > &  m)
inline
template<typename T = double>
bool utl::SparseMatrix< T >::operator== ( const SparseMatrix< T > &  m) const
inline

be sure to call Reclaim() first

Definition at line 178 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fInitializer, and utl::SparseMatrix< T >::fMatrix.

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

template<typename T = double>
template<typename U >
bool utl::SparseMatrix< T >::operator== ( const SparseMatrix< U > &  m) const
inline
template<typename T = double>
SparseMatrix::Row utl::SparseMatrix< T >::operator[] ( const IndexType  row) const
inline

noncreational [] access trough proxy

Definition at line 131 of file SparseMatrix.h.

template<typename T = double>
unsigned int utl::SparseMatrix< T >::Reclaim ( )
inline
template<typename T = double>
Iterator utl::SparseMatrix< T >::SparseBegin ( )
inline
template<typename T = double>
ConstIterator utl::SparseMatrix< T >::SparseBegin ( ) const
inline

Definition at line 217 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

template<typename T = double>
Iterator utl::SparseMatrix< T >::SparseEnd ( )
inline
template<typename T = double>
ConstIterator utl::SparseMatrix< T >::SparseEnd ( ) const
inline

Definition at line 221 of file SparseMatrix.h.

References utl::SparseMatrix< T >::fMatrix.

template<typename T = double>
void utl::SparseMatrix< T >::Transpose ( )
inline

Friends And Related Function Documentation

template<typename T = double>
template<typename U >
friend class SparseMatrix
friend

Definition at line 279 of file SparseMatrix.h.

Member Data Documentation

template<typename T = double>
utl::SparseMatrix< T >::__pad0__

Definition at line 118 of file SparseMatrix.h.

template<typename T = double>
bool utl::SparseMatrix< T >::const
Initial value:
{
const MapConstIterator it = fMatrix.find(IndexKeyType(row, column))

Definition at line 157 of file SparseMatrix.h.

template<typename T = double>
const T utl::SparseMatrix< T >::fInitializer
private
template<typename T = double>
MapType utl::SparseMatrix< T >::fMatrix
private
template<typename T = double>
utl::SparseMatrix< T >::it = m.SparseEnd()
template<typename T = double>
return utl::SparseMatrix< T >::it == fMatrix.end()

Definition at line 159 of file SparseMatrix.h.

template<typename T = double>
it(* utl::SparseMatrix< T >::this)(it.GetRow(), it.GetColumn()) = it()

Definition at line 120 of file SparseMatrix.h.


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

, generated on Tue Sep 26 2023.