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 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, DoubleReal, Real. 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 SparseVector< Real >::getMinElement().
|
inline |
const begin iterator
|
inline |
removes all elements
|
inline |
true if the container is empty
|
inline |
end iterator
Referenced by SparseVector< Real >::getMinElement().
|
inline |
const end iterator
|
inline |
erase indicated element(iterator) and imediately 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(halfopen iterator-range) and imediately 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
|
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< Real >::at(), and SparseVector< Real >::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 the vector to param newsize
|
inline |
size of the represented vector
Referenced by SparseVector< Real >::empty(), SparseVector< Real >::end(), SparseVector< Real >::rbegin(), and SparseVector< Real >::SparseVector().
|
inlineprotected |
Updates position of it and all larger elements.
Referenced by SparseVector< Real >::erase().
|
private |
size including sparse elements
Referenced by SparseVector< Real >::at(), SparseVector< Real >::clear(), SparseVector< Real >::erase(), SparseVector< Real >::getMinElement(), SparseVector< Value >::SparseVectorIterator::hop(), SparseVector< Value >::SparseVectorConstIterator::hop(), SparseVector< Value >::SparseVectorIterator::operator*(), SparseVector< Value >::SparseVectorReverseIterator::operator*(), SparseVector< Value >::SparseVectorConstIterator::operator*(), SparseVector< Value >::SparseVectorConstReverseIterator::operator*(), SparseVector< Value >::SparseVectorConstIterator::operator++(), SparseVector< Value >::SparseVectorConstIterator::operator--(), SparseVector< Real >::operator=(), SparseVector< Real >::operator==(), SparseVector< Real >::operator[](), SparseVector< Value >::SparseVectorIterator::operator[](), SparseVector< Value >::SparseVectorReverseIterator::operator[](), SparseVector< Value >::SparseVectorConstIterator::operator[](), SparseVector< Real >::push_back(), SparseVector< Real >::resize(), and SparseVector< Real >::size().
|
protected |
sparse element
Referenced by SparseVector< Real >::getMinElement(), SparseVector< Value >::ValueProxy::operator double(), SparseVector< Value >::ValueProxy::operator float(), SparseVector< Value >::ValueProxy::operator int(), SparseVector< Real >::operator=(), SparseVector< Value >::ValueProxy::operator=(), SparseVector< Real >::operator==(), and SparseVector< Real >::SparseVector().
|
private |
underlying map
Referenced by SparseVector< Real >::clear(), SparseVector< Real >::erase(), SparseVector< Real >::getMinElement(), SparseVector< Value >::SparseVectorIterator::hop(), SparseVector< Value >::SparseVectorConstIterator::hop(), SparseVector< Real >::nonzero_size(), SparseVector< Value >::ValueProxy::operator double(), SparseVector< Value >::ValueProxy::operator float(), SparseVector< Value >::ValueProxy::operator int(), SparseVector< Real >::operator<(), SparseVector< Real >::operator=(), SparseVector< Value >::ValueProxy::operator=(), SparseVector< Real >::operator==(), SparseVector< Real >::print(), SparseVector< Real >::resize(), SparseVector< Value >::SparseVectorReverseIterator::rhop(), SparseVector< Value >::SparseVectorConstReverseIterator::rhop(), SparseVector< Real >::SparseVector(), and SparseVector< Real >::update_().
| OpenMS / TOPP release 1.11.1 | Documentation generated on Thu Nov 14 2013 11:19:29 using doxygen 1.8.5 |