Parameter | Description | Default |
---|---|---|
T | the vector's value_type | |
S | size-type | int |
AllocT | the vector's allocator [1] | std::allocator<T> |
AllocS | the vector's allocator [1] | std::allocator<S> |
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 | |
sparse_vector() | DefaultConstructible | The vector's size after default-construction will be equal to 0. |
sparse_vector(size_type) | SizeConstructible | |
sparse_vector(sparse_vector const&) | Assignable, Expression | Deep copies the elements |
sparse_vector& operator=(sparse_vector const&) | Assignable | |
~sparse_vector() | Expression | |
bool operator==(sparse_vector const&) const | EqualityComparable | |
bool operator!=(sparse_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 |
value_vector_type const& value_vector() const |
Needed for implementation of views: returns the vector of values. | |
value_vector_type& value_vector() |
Needed for implementation of views: returns the vector of values. |
Function | Where defined | Comment |
---|
[1] The AllocT and AllocS template arguments provide 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
.