SparseVector implementation. The container will not actually store a specified type of element - the sparse element, e.g. zero (by default) More...
#include <OpenMS/DATASTRUCTURES/SparseVector.h>
Classes | |
class | SparseVectorConstIterator |
const_iterator for SparseVector More... | |
class | SparseVectorConstReverseIterator |
const_reverse_iterator for SparseVector More... | |
class | SparseVectorIterator |
random access iterator for SparseVector including the hop() function to jump to the next non-sparse element More... | |
class | SparseVectorReverseIterator |
random access reverse iterator for SparseVector including the hop() function to jump to the next non-sparse element More... | |
class | ValueProxy |
class ValueProxy allows the SparseVector to differentiate between writing and reading, so zeros can be ignored See "more effective c++" section 30 More... | |
Public Member Functions | |
void | print () const |
SparseVector () | |
default constructor More... | |
SparseVector (Value se) | |
constructor with chosen sparse element More... | |
SparseVector (size_type size, Value value, Value se=0) | |
detailed constructor, use with filling element value is discouraged unless it is the same as sparse element se More... | |
SparseVector (const SparseVector &source) | |
copy constructor More... | |
SparseVector & | operator= (const SparseVector &source) |
assignment operator More... | |
~SparseVector () | |
destructor More... | |
bool | operator== (const SparseVector &rhs) const |
equality operator More... | |
bool | operator< (const SparseVector &rhs) const |
less than operator More... | |
size_type | nonzero_size () const |
number of nonzero elements, i.e. the space actually used More... | |
size_type | size () const |
size of the represented vector More... | |
bool | empty () const |
true if the container is empty More... | |
void | push_back (Value value) |
push_back (see stl vector docs) More... | |
Value | at (size_type pos) const |
const Value | operator[] (size_type pos) const |
ValueProxy handles the conversion to int and ,the writing ( if != sparseElement ) More... | |
ValueProxy | operator[] (size_type pos) |
ValueProxy handles the conversion and the writing ( if != sparseElement ) More... | |
void | clear () |
removes all elements More... | |
void | resize (size_type newsize) |
resizes the vector to param newsize More... | |
void | erase (SparseVectorIterator it) |
void | erase (SparseVectorIterator first, SparseVectorIterator last) |
SparseVectorIterator | getMinElement () |
gets an Iterator to the element (including sparseElements) with the minimal value More... | |
iterator | begin () |
begin iterator More... | |
iterator | end () |
end iterator More... | |
reverse_iterator | rbegin () |
rbegin iterator More... | |
reverse_iterator | rend () |
rend iterator More... | |
const_iterator | begin () const |
const begin iterator More... | |
const_iterator | end () const |
const end iterator More... | |
const_reverse_iterator | rbegin () const |
const begin reverse_iterator More... | |
const_reverse_iterator | rend () const |
const end reverse_iterator More... | |
Protected Member Functions | |
void | update_ (map_iterator it, Size amount_deleted) |
Updates position of it and all larger elements. More... | |
Protected Attributes | |
Value | sparse_element_ |
sparse element More... | |
Private Attributes | |
std::map< size_type, Value > | values_ |
underlying map More... | |
size_type | size_ |
size including sparse elements More... | |
SparseVector implementation. The container will not actually store a specified type of element - the sparse element, e.g. zero (by default)
SparseVector for allround usage, will work with Int, UInt, double, float. This should use less space than a normal vector (if more than half of the elements are sparse elements, since the underlying structure is a map) and functions can just ignore sparse elements (hop(),
typedef std::map<size_t, Value>::allocator_type allocator_type |
typedef const ValueProxy& const_reference |
typedef std::map<size_t, Value>::difference_type difference_type |
typedef SparseVectorIterator iterator |
typedef SparseVectorIterator Iterator |
typedef std::map<size_t, Value>::const_iterator map_const_iterator |
typedef std::map<size_t, Value>::iterator map_iterator |
typedef Value* pointer |
typedef ValueProxy& reference |
typedef std::map<size_t, Value>::const_reverse_iterator reverse_map_const_iterator |
typedef std::map<size_t, Value>::reverse_iterator reverse_map_iterator |
typedef Value value_type |
|
inline |
default constructor
|
inline |
constructor with chosen sparse element
|
inline |
detailed constructor, use with filling element value is discouraged unless it is the same as sparse element se
|
inline |
copy constructor
|
inline |
destructor
|
inline |
at (see stl vector docs)
pos | index at which the desired element stays |
OutOfRange | is thrown if the index is greater or equal than the size of the vector |
|
inline |
begin iterator
Referenced by BinnedSpectrum::begin(), and SparseVector< float >::getMinElement().
|
inline |
const begin iterator
|
inline |
removes all elements
|
inline |
true if the container is empty
Referenced by BinnedSpectrum::getBins().
|
inline |
end iterator
Referenced by BinnedSpectrum::end(), and SparseVector< float >::getMinElement().
|
inline |
const end iterator
|
inline |
erase indicated element(iterator) and immediately update indices in map
it | parameter which specifies the element which should be deleted |
OutOfRange | is thrown if the iterator does not point to an element |
|
inline |
erase indicated element(half open iterator-range) and immediately update indices in map
first | iterator that points to the begin of the range which should be erased |
last | iterator that points one position behind the last position which should be erased |
|
inline |
gets an Iterator to the element (including sparseElements) with the minimal value
|
inline |
number of nonzero elements, i.e. the space actually used
Referenced by BinnedSpectrum::getFilledBinNumber().
|
inline |
less than operator
|
inline |
assignment operator
|
inline |
equality operator
|
inline |
ValueProxy handles the conversion to int and ,the writing ( if != sparseElement )
Referenced by SparseVector< float >::at(), and SparseVector< float >::push_back().
|
inline |
ValueProxy handles the conversion and the writing ( if != sparseElement )
|
inline |
|
inline |
push_back (see stl vector docs)
|
inline |
rbegin iterator
|
inline |
const begin reverse_iterator
|
inline |
rend iterator
|
inline |
const end reverse_iterator
|
inline |
resizes the vector to param newsize
|
inline |
size of the represented vector
Referenced by SparseVector< float >::empty(), SparseVector< float >::end(), BinnedSpectrum::getBinNumber(), SparseVector< float >::rbegin(), and SparseVector< float >::SparseVector().
|
inlineprotected |
Updates position of it
and all larger elements.
Referenced by SparseVector< float >::erase().
|
private |
size including sparse elements
Referenced by SparseVector< float >::at(), SparseVector< float >::clear(), SparseVector< float >::erase(), SparseVector< float >::getMinElement(), SparseVector< float >::operator=(), SparseVector< float >::operator==(), SparseVector< float >::operator[](), SparseVector< float >::push_back(), SparseVector< float >::resize(), and SparseVector< float >::size().
|
protected |
sparse element
Referenced by SparseVector< float >::getMinElement(), SparseVector< Value >::ValueProxy::operator double(), SparseVector< Value >::ValueProxy::operator float(), SparseVector< Value >::ValueProxy::operator int(), SparseVector< float >::operator=(), SparseVector< Value >::ValueProxy::operator=(), SparseVector< float >::operator==(), and SparseVector< float >::SparseVector().
|
private |
underlying map
Referenced by SparseVector< float >::clear(), SparseVector< float >::erase(), SparseVector< float >::getMinElement(), SparseVector< float >::nonzero_size(), SparseVector< Value >::ValueProxy::operator double(), SparseVector< Value >::ValueProxy::operator float(), SparseVector< Value >::ValueProxy::operator int(), SparseVector< float >::operator<(), SparseVector< float >::operator=(), SparseVector< Value >::ValueProxy::operator=(), SparseVector< float >::operator==(), SparseVector< float >::print(), SparseVector< float >::resize(), and SparseVector< float >::SparseVector().
OpenMS / TOPP release 2.3.0 | Documentation generated on Tue Jan 9 2018 18:22:12 using doxygen 1.8.13 |