Sparse array allowing space efficient access of the form s[3000] = 2;. More...
#include <vbl_sparse_array_1d.h>
Public Types | |
typedef vbl_sparse_array_base < T, unsigned > ::const_iterator | const_iterator |
The type of iterators into the efficient storage. | |
typedef vcl_size_t | size_type |
typedef unsigned | Index_type |
The type of objects used to index the sparse array. | |
typedef T | T_type |
The type of values stored by the sparse array. | |
typedef Map::value_type | sequence_value_type |
The type of values of the controlled sequence. | |
Public Member Functions | |
vcl_ostream & | print (vcl_ostream &out) const |
Print the Array to a stream in "(i,j): value" format. | |
T & | operator() (unsignedi) |
Return contents at (i). | |
T const & | operator() (unsignedi) const |
Return contents at (i). Asserts that (i) is non-empty. | |
void | erase (unsigned) |
Erase element at location (i). Assertion failure if not yet filled. | |
bool | fullp (unsigned) const |
Return true if location (i) has been filled. | |
bool | put (unsigned, const T &) |
Put a value into location (i). | |
T * | get_addr (unsigned) |
Return the address of location (i). 0 if not yet filled. | |
void | clear () |
Empty the sparse matrix. | |
size_type | count_nonempty () const |
Return number of locations that have been assigned a value using "put". | |
const_iterator | begin () const |
A bidirectional iterator pointing at the first non-empty element. | |
const_iterator | end () const |
A bidirectional iterator pointing just beyond last non-empty element. | |
Protected Types | |
typedef vcl_map< unsigned, T, vcl_less< unsigned > > | Map |
The type of the storage. | |
Protected Attributes | |
Map | storage_ |
This stores a compact list of the values. |
Sparse array allowing space efficient access of the form s[3000] = 2;.
Definition at line 23 of file vbl_sparse_array_1d.h.
typedef vbl_sparse_array_base<T,unsigned>::const_iterator vbl_sparse_array_1d< T >::const_iterator |
The type of iterators into the efficient storage.
Reimplemented from vbl_sparse_array_base< T, unsigned >.
Definition at line 26 of file vbl_sparse_array_1d.h.
typedef unsigned vbl_sparse_array_base< T, unsigned >::Index_type [inherited] |
The type of objects used to index the sparse array.
Definition at line 77 of file vbl_sparse_array_base.h.
typedef vcl_map<unsigned , T, vcl_less<unsigned > > vbl_sparse_array_base< T, unsigned >::Map [protected, inherited] |
The type of the storage.
Definition at line 41 of file vbl_sparse_array_base.h.
typedef Map::value_type vbl_sparse_array_base< T, unsigned >::sequence_value_type [inherited] |
The type of values of the controlled sequence.
The value_type is a vcl_pair<Index_type, typename T_type>
Definition at line 84 of file vbl_sparse_array_base.h.
typedef vcl_size_t vbl_sparse_array_base< T, unsigned >::size_type [inherited] |
Definition at line 47 of file vbl_sparse_array_base.h.
typedef T vbl_sparse_array_base< T, unsigned >::T_type [inherited] |
The type of values stored by the sparse array.
Definition at line 80 of file vbl_sparse_array_base.h.
const_iterator vbl_sparse_array_base< T, unsigned >::begin | ( | ) | const [inline, inherited] |
A bidirectional iterator pointing at the first non-empty element.
If the array is empty it points just beyond the end.
Definition at line 88 of file vbl_sparse_array_base.h.
void vbl_sparse_array_base< T, unsigned >::clear | ( | ) | [inherited] |
Empty the sparse matrix.
size_type vbl_sparse_array_base< T, unsigned >::count_nonempty | ( | ) | const [inline, inherited] |
Return number of locations that have been assigned a value using "put".
Definition at line 74 of file vbl_sparse_array_base.h.
const_iterator vbl_sparse_array_base< T, unsigned >::end | ( | ) | const [inline, inherited] |
A bidirectional iterator pointing just beyond last non-empty element.
Definition at line 91 of file vbl_sparse_array_base.h.
void vbl_sparse_array_base< T, unsigned >::erase | ( | unsigned | ) | [inherited] |
Erase element at location (i). Assertion failure if not yet filled.
bool vbl_sparse_array_base< T, unsigned >::fullp | ( | unsigned | ) | const [inherited] |
Return true if location (i) has been filled.
T* vbl_sparse_array_base< T, unsigned >::get_addr | ( | unsigned | ) | [inherited] |
Return the address of location (i). 0 if not yet filled.
Return the memory address of location (i). 0 if not yet filled.
T& vbl_sparse_array_base< T, unsigned >::operator() | ( | unsigned | i | ) | [inline, inherited] |
Return contents at (i).
Definition at line 50 of file vbl_sparse_array_base.h.
T const& vbl_sparse_array_base< T, unsigned >::operator() | ( | unsigned | i | ) | const [inherited] |
Return contents at (i). Asserts that (i) is non-empty.
Return contents of (i). Assertion failure if not yet filled.
vcl_ostream& vbl_sparse_array_1d< T >::print | ( | vcl_ostream & | out | ) | const [inline] |
Print the Array to a stream in "(i,j): value" format.
Definition at line 29 of file vbl_sparse_array_1d.h.
bool vbl_sparse_array_base< T, unsigned >::put | ( | unsigned | , |
const T & | |||
) | [inherited] |
Put a value into location (i).
Map vbl_sparse_array_base< T, unsigned >::storage_ [protected, inherited] |
This stores a compact list of the values.
Definition at line 43 of file vbl_sparse_array_base.h.