std::map. This might be not
so usefull but this clarifies the relation between the glas sparse-vector's and the
std::map which is currently the main C++ standard class that is used
to describe sparse vectors.
| Parameter | Description | Default |
|---|---|---|
| T | the vector's value_type | |
| Alloc | the vector's allocator [1] | std::allocator<T> |
| S | size-type | int |
| ZeroFunctor | Functor used to return structural zero | zero<::value_type> |
| DuplicateFunctor | Functor used to decide what should happen if a value is assigned to an index that is already a structural non-zero | project2nd<::value_type,value_type> [2] |
| T | Must be a model of Assignable |
| Member | Where defined | Comment |
|---|---|---|
| size_type | VectorExpression | |
| value_type | VectorExpression | |
| const_reference | VectorExpression | Defined as value_type const &. |
| reference | VectorCollection | Defined as value_type&. |
nnz_type |
SparseExpression | |
| mapped_vector() | DefaultConstructible | The vector's size after default-construction will be equal to 0. |
| mapped_vector(size_type) | SizeConstructible | |
| mapped_vector(mapped_vector const&) | Assignable, Expression | Deep copies the elements |
| mapped_vector& operator=(mapped_vector const&) | Assignable | |
| ~mapped_vector() | Expression | |
| bool operator==(mapped_vector const&) const | EqualityComparable | |
| bool operator!=(mapped_vector const&) const | EqualityComparable | |
| size_type size() const | VectorExpression, SizeConstructible | |
| void resize(size_type) | SizeConstructible | |
| const_reference operator[](size_type) const | VectorExpression | returns ZeroFunctor() if the index corrsponds to a structural zero |
| const_reference operator()(size_type) const | VectorExpression | identical to operator[](size_type) const
|
| reference operator[](size_type) | VectorCollection | Returns a proxy. If the proxy is being read, operator[](size_type)
behaves identical to its const-counterpart. If the proxy is being assigned to,
insert will be called.
|
| reference operator()(size_type) | VectorCollection | identical to operator[](size_type)
|
nnz_type nnz() |
SparseExpression | |
const_reference nz(nnz_type) const |
SparseExpression | |
reference nz(nnz_type) |
SparseVectorCollection | |
void insert(size_type,const_reference) |
SparseVector | If the index already corresponds to a structural non-zero, DuplicateFunctor will be used to determine what to do with the old value |
| Function | Where defined | Comment |
|---|
[1] The Alloc template argument provides not enough flexibility and room for optimisation. Therefore it will be replaced by a storage type in the future that will allow to easily allocate vector's on heap but also on the stack, in user-defined pools etc. See also the SGI allocators for more background info.
[2] The DuplicateFunctor is set to project2nd by default because this matches the behaviour
of std::vector and glas::dense_vector.