StochHMM
v0.34
Flexible Hidden Markov Model C++ Library and Application
|
#include <sparseArray.h>
Public Member Functions | |
sparseArray () | |
sparseArray (size_t sz) | |
sparseArray (const sparseArray &val) | |
void | clear () |
Removes all the elements from the array. | |
void | reserve (size_t) |
Reserved memory for at least n elements in the array;. | |
void | resize (size_t) |
Resize the sparseArray to n;. | |
size_t | elements () |
Returns the number of elements stored in the array. | |
size_t | size () |
Returns the size of the sparseArray. | |
T & | operator[] (size_t) |
const T & | operator[] (size_t) const |
T & | at (size_t pos) |
T & | back () |
const T & | back () const |
bool | operator== (const sparseArray &rhs) |
bool | operator!= (const sparseArray &rhs) |
sparseArray & | operator= (const sparseArray &rhs) |
bool | defined (size_t pos) |
void | insert (size_t pos, T &val) |
void | push_back (T &) |
Pushes the element on to the array. | |
void | erase (size_t pos) |
void | pop_back (size_t pos) |
Private Attributes | |
dynamic_bitset | flag |
std::vector< T > | array |
SparseArray is a template class that stores the values in a sparse array The values in the array are indexed by a dynamic bitset. For example, to get the value at iterator 5, we need to convert that iterator to the iterator of the std::vector array. This is essentially the number of values that are stored before the value at the 5th position.
SparseArray uses std::vector. This means that it will incure an increased cost of inserting and deleting values.
Definition at line 29 of file sparseArray.h.
StochHMM::sparseArray< T >::sparseArray | ( | ) |
|
inline |
Definition at line 32 of file sparseArray.h.
|
inline |
Definition at line 33 of file sparseArray.h.
|
inline |
Definition at line 50 of file sparseArray.h.
T& StochHMM::sparseArray< T >::back | ( | ) |
const T& StochHMM::sparseArray< T >::back | ( | ) | const |
void StochHMM::sparseArray< T >::clear | ( | ) |
Removes all the elements from the array.
Definition at line 81 of file sparseArray.h.
|
inline |
Return whether an element is defined at position
Definition at line 64 of file sparseArray.h.
Referenced by StochHMM::ExDefSequence::_parseAbsDef(), StochHMM::ExDefSequence::_parseWeightDef(), StochHMM::ExDefSequence::defined(), StochHMM::ExDefSequence::getAbsState(), StochHMM::ExDefSequence::getWeight(), StochHMM::ExDefSequence::isAbsolute(), StochHMM::ExDefSequence::isWeighted(), and StochHMM::ExDefSequence::print().
|
inline |
Returns the number of elements stored in the array.
Definition at line 41 of file sparseArray.h.
void StochHMM::sparseArray< T >::erase | ( | size_t | pos | ) |
void StochHMM::sparseArray< T >::insert | ( | size_t | pos, |
T & | val | ||
) |
Insert an element at the position in the array
pos | Position within the array to insert value |
reference | to value to insert |
Definition at line 126 of file sparseArray.h.
bool StochHMM::sparseArray< T >::operator!= | ( | const sparseArray< T > & | rhs | ) |
sparseArray& StochHMM::sparseArray< T >::operator= | ( | const sparseArray< T > & | rhs | ) |
bool StochHMM::sparseArray< T >::operator== | ( | const sparseArray< T > & | rhs | ) |
T & StochHMM::sparseArray< T >::operator[] | ( | size_t | pos | ) |
Returns reference to object at position *If the position is beyond the length, the sparse array will get extended. *If it is defined it will return a reference to the position *If it is not defined and within the current length of the sparseArray and after all the currently set values , it will get added to the end of the array *If it is not defined and within the current lenght of the sparseArray and before other currently set values, then it will get inserted into the array
Definition at line 142 of file sparseArray.h.
const T & StochHMM::sparseArray< T >::operator[] | ( | size_t | pos | ) | const |
Returns reference to object at position *If it is defined it will return a reference to the position
Definition at line 177 of file sparseArray.h.
void StochHMM::sparseArray< T >::pop_back | ( | size_t | pos | ) |
void StochHMM::sparseArray< T >::push_back | ( | T & | val | ) |
Pushes the element on to the array.
Definition at line 116 of file sparseArray.h.
void StochHMM::sparseArray< T >::reserve | ( | size_t | n | ) |
Reserved memory for at least n elements in the array;.
Definition at line 89 of file sparseArray.h.
void StochHMM::sparseArray< T >::resize | ( | size_t | n | ) |
Resize the sparseArray to n;.
Definition at line 97 of file sparseArray.h.
|
inline |
Returns the size of the sparseArray.
Definition at line 44 of file sparseArray.h.
Referenced by StochHMM::ExDefSequence::print().
|
private |
Definition at line 76 of file sparseArray.h.
|
private |
Definition at line 75 of file sparseArray.h.
Referenced by StochHMM::sparseArray< double >::defined(), StochHMM::sparseArray< double >::elements(), and StochHMM::sparseArray< double >::size().