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

Sparse container class for vectorial data. More...

#include "utl/SparseVector.h"

Classes

class  IteratorTransformer
 

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 index)
 
ConstIterator Find (const IndexType index) const
 
const T & GetInitializer () const
 
unsigned int GetNonEmptySize () const
 
bool IsEmpty () const
 
bool operator!= (const SparseVector< T > &v) const
 
template<typename U >
bool operator!= (const SparseVector< U > &v) const
 
T & operator() (const IndexType index)
 creating element access More...
 
const T & operator() (const IndexType index) const
 
template<typename U >
SparseVectoroperator*= (const U &value)
 multiplication with scalar More...
 
template<typename U >
SparseVectoroperator+= (const SparseVector< U > &m)
 vector addition More...
 
template<typename U >
SparseVectoroperator-= (const SparseVector< U > &m)
 vector subtraction More...
 
bool operator== (const SparseVector< T > &v) const
 
template<typename U >
bool operator== (const SparseVector< U > &v) const
 
const T & operator[] (const IndexType index) const
 noncreating element access More...
 
unsigned int Reclaim ()
 remove "empty" elements (that are equal to the initializer) More...
 
Iterator SparseBegin ()
 
ConstIterator SparseBegin () const
 
Iterator SparseEnd ()
 
ConstIterator SparseEnd () const
 

Public Attributes

 __pad0__: fInitializer(init) { } template<typename U> explicit SparseVector(const SparseVector<U>& v) : fInitializer(v.GetInitializer()) { for (typename SparseVector<U>::ConstIterator it = v.SparseBegin()
 
bool const
 
 it = v.SparseEnd()
 
return it == fVector.end()
 
it(* this )(it.GetIndex()) = it()
 

Private Types

typedef MapType::const_iterator MapConstIterator
 
typedef MapType::iterator MapIterator
 
typedef std::map< IndexType, T > MapType
 
typedef MapType::value_type MapValueType
 

Private Member Functions

void Erase (const MapIterator it)
 

Private Attributes

constfInitializer
 
MapType fVector
 

Detailed Description

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

Sparse container class for vectorial data.

Importatant notes:

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

Author
Darko Veberic
Date
3 Jun 2008

Definition at line 36 of file SparseVector.h.

Member Typedef Documentation

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

Definition at line 176 of file SparseVector.h.

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

Definition at line 38 of file SparseVector.h.

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

Definition at line 175 of file SparseVector.h.

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

Definition at line 44 of file SparseVector.h.

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

Definition at line 43 of file SparseVector.h.

template<typename T = double>
typedef std::map<IndexType, T> utl::SparseVector< T >::MapType
private

Definition at line 41 of file SparseVector.h.

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

Definition at line 42 of file SparseVector.h.

Member Function Documentation

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

Definition at line 86 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

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

Definition at line 226 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

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

template<typename T = double>
Iterator utl::SparseVector< T >::Find ( const IndexType  index)
inline

Definition at line 186 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

Referenced by utl::operator*(), and TestSparseVector::TestIterators().

template<typename T = double>
ConstIterator utl::SparseVector< T >::Find ( const IndexType  index) const
inline

Definition at line 189 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

template<typename T = double>
const T& utl::SparseVector< T >::GetInitializer ( ) const
inline

Definition at line 84 of file SparseVector.h.

References utl::SparseVector< T >::fInitializer.

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

template<typename T = double>
unsigned int utl::SparseVector< T >::GetNonEmptySize ( ) const
inline
template<typename T = double>
bool utl::SparseVector< T >::IsEmpty ( ) const
inline

Definition at line 112 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

Referenced by utl::Output(), and TestSparseVector::TestAddSubtract().

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

Definition at line 146 of file SparseVector.h.

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

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

Definition at line 172 of file SparseVector.h.

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

template<typename T = double>
T& utl::SparseVector< T >::operator() ( const IndexType  index)
inline

creating element access

Definition at line 99 of file SparseVector.h.

References utl::SparseVector< T >::fInitializer, and utl::SparseVector< T >::fVector.

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

multiplication with scalar

Definition at line 195 of file SparseVector.h.

References utl::SparseVector< T >::fVector, and utl::SparseVector< T >::it.

template<typename T = double>
template<typename U >
SparseVector& utl::SparseVector< T >::operator+= ( const SparseVector< U > &  m)
inline
template<typename T = double>
template<typename U >
SparseVector& utl::SparseVector< T >::operator-= ( const SparseVector< U > &  m)
inline
template<typename T = double>
bool utl::SparseVector< T >::operator== ( const SparseVector< T > &  v) const
inline
template<typename T = double>
template<typename U >
bool utl::SparseVector< T >::operator== ( const SparseVector< U > &  v) const
inline
template<typename T = double>
const T& utl::SparseVector< T >::operator[] ( const IndexType  index) const
inline

noncreating element access

Definition at line 90 of file SparseVector.h.

References utl::SparseVector< T >::fInitializer, utl::SparseVector< T >::fVector, and utl::SparseVector< T >::it.

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

Definition at line 180 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

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

Definition at line 184 of file SparseVector.h.

References utl::SparseVector< T >::fVector.

Member Data Documentation

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

Definition at line 77 of file SparseVector.h.

template<typename T = double>
bool utl::SparseVector< T >::const
Initial value:
{
const MapConstIterator it = fVector.find(index)

Definition at line 117 of file SparseVector.h.

template<typename T = double>
const T utl::SparseVector< T >::fInitializer
private
template<typename T = double>
MapType utl::SparseVector< T >::fVector
private
template<typename T = double>
utl::SparseVector< T >::it = v.SparseEnd()
template<typename T = double>
return utl::SparseVector< T >::it == fVector.end()

Definition at line 119 of file SparseVector.h.

template<typename T = double>
it(* utl::SparseVector< T >::this)(it.GetIndex()) = it()

Definition at line 79 of file SparseVector.h.


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

, generated on Tue Sep 26 2023.