Compressed array based sparse vector. More...
#include <shark/LinAlg/BLAS/vector_sparse.hpp>
Classes | |
class | reference |
Public Types | |
typedef const T & | const_reference |
typedef elementwise< sparse_tag > | evaluation_category |
typedef iterators::compressed_storage_iterator< value_type const, size_type const > | const_iterator |
typedef iterators::compressed_storage_iterator< value_type, size_type const > | iterator |
Public Member Functions | |
compressed_vector () | |
compressed_vector (size_type size, value_type value=value_type(), size_type non_zeros=0) | |
template<class AE > | |
compressed_vector (vector_expression< AE, cpu_tag > const &ae, size_type non_zeros=0) | |
size_type | size () const |
size_type | nnz_capacity () const |
size_type | nnz () const |
void | set_filled (size_type filled) |
storage_type | raw_storage () |
Returns the underlying storage structure for low level access. More... | |
const_storage_type | raw_storage () const |
Returns the underlying storage structure for low level access. More... | |
device_traits< cpu_tag >::queue_type & | queue () |
void | resize (size_type size) |
void | reserve (size_type non_zeros) |
const_reference | operator() (size_type i) const |
reference | operator() (size_type i) |
const_reference | operator[] (size_type i) const |
reference | operator[] (size_type i) |
void | clear () |
compressed_vector & | operator= (compressed_vector const &v) |
template<class C > | |
compressed_vector & | operator= (vector_container< C, cpu_tag > const &v) |
template<class AE > | |
compressed_vector & | operator= (vector_expression< AE, cpu_tag > const &ae) |
void | swap (compressed_vector &v) |
const_iterator | begin () const |
const_iterator | end () const |
iterator | begin () |
iterator | end () |
iterator | set_element (iterator pos, size_type index, value_type value) |
iterator | clear_range (iterator start, iterator end) |
iterator | clear_element (iterator pos) |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int) |
Public Member Functions inherited from remora::vector_container< compressed_vector< T, I >, cpu_tag > | |
const container_type & | operator() () const |
container_type & | operator() () |
Public Member Functions inherited from remora::vector_expression< compressed_vector< T, I >, cpu_tag > | |
const expression_type & | operator() () const |
expression_type & | operator() () |
Friends | |
void | swap (compressed_vector &v1, compressed_vector &v2) |
Compressed array based sparse vector.
a sparse vector of values of type T of variable size. The non zero values are stored as two seperate arrays: an index array and a value array. The index array is always sorted and there is at most one entry for each index. Inserting an element can be time consuming. If the vector contains a few zero entries, then it is better to have a normal vector. If the vector has a very high dimension with a few non-zero values, then this vector is very memory efficient (at the cost of a few more computations).
For a \(n\)-dimensional compressed vector and \(0 \leq i < n\) the non-zero elements \(v_i\) are mapped to consecutive elements of the index and value container, i.e. for elements \(k = v_{i_1}\) and \(k + 1 = v_{i_2}\) of these containers holds \(i_1 < i_2\).
Supported parameters for the adapted array (indices and values) are unbounded_array<>
, bounded_array<>
and std::vector<>
.
T | the type of object stored in the vector (like double, float, complex, etc...) |
I | the indices stored in the vector |
Definition at line 60 of file vector_sparse.hpp.
typedef iterators::compressed_storage_iterator<value_type const, size_type const> remora::compressed_vector< T, I >::const_iterator |
Definition at line 251 of file vector_sparse.hpp.
typedef const T& remora::compressed_vector< T, I >::const_reference |
Definition at line 66 of file vector_sparse.hpp.
typedef elementwise<sparse_tag> remora::compressed_vector< T, I >::evaluation_category |
Definition at line 138 of file vector_sparse.hpp.
typedef iterators::compressed_storage_iterator<value_type, size_type const> remora::compressed_vector< T, I >::iterator |
Definition at line 252 of file vector_sparse.hpp.
|
inline |
Definition at line 141 of file vector_sparse.hpp.
|
inlineexplicit |
Definition at line 142 of file vector_sparse.hpp.
|
inline |
Definition at line 145 of file vector_sparse.hpp.
References remora::assign().
|
inline |
Definition at line 254 of file vector_sparse.hpp.
Referenced by remora::compressed_vector< T, I >::clear_element(), remora::compressed_vector< T, I >::clear_range(), remora::compressed_vector< T, I >::serialize(), and remora::compressed_vector< T, I >::set_element().
|
inline |
Definition at line 262 of file vector_sparse.hpp.
|
inline |
Definition at line 213 of file vector_sparse.hpp.
|
inline |
Definition at line 317 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::begin(), and remora::compressed_vector< T, I >::end().
|
inline |
Definition at line 300 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::begin().
|
inline |
Definition at line 258 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::nnz().
Referenced by remora::compressed_vector< T, I >::clear_element(), remora::compressed_vector< T, I >::serialize(), and remora::compressed_vector< T, I >::set_element().
|
inline |
Definition at line 266 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::nnz().
|
inline |
Definition at line 158 of file vector_sparse.hpp.
Referenced by remora::compressed_vector< T, I >::end(), remora::compressed_vector< T, I >::operator()(), and remora::compressed_vector< T, I >::serialize().
|
inline |
Definition at line 155 of file vector_sparse.hpp.
Referenced by remora::compressed_vector< T, I >::operator=(), remora::compressed_vector< T, I >::reserve(), remora::compressed_vector< T, I >::set_element(), and remora::compressed_vector< T, I >::set_filled().
|
inline |
Definition at line 193 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::nnz().
|
inline |
Definition at line 200 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::reference::reference().
|
inline |
Definition at line 218 of file vector_sparse.hpp.
|
inline |
Definition at line 226 of file vector_sparse.hpp.
References remora::assign(), remora::compressed_vector< T, I >::resize(), and remora::compressed_vector< T, I >::size().
|
inline |
Definition at line 232 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::nnz_capacity(), and remora::compressed_vector< T, I >::swap().
|
inline |
Definition at line 205 of file vector_sparse.hpp.
|
inline |
Definition at line 208 of file vector_sparse.hpp.
|
inline |
Definition at line 177 of file vector_sparse.hpp.
|
inline |
Returns the underlying storage structure for low level access.
Definition at line 168 of file vector_sparse.hpp.
|
inline |
Returns the underlying storage structure for low level access.
Definition at line 173 of file vector_sparse.hpp.
|
inline |
Definition at line 185 of file vector_sparse.hpp.
References remora::min(), remora::compressed_vector< T, I >::nnz_capacity(), and remora::compressed_vector< T, I >::size().
Referenced by remora::compressed_vector< T, I >::set_element().
|
inline |
Definition at line 181 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::size().
Referenced by remora::compressed_vector< T, I >::operator=().
|
inline |
Definition at line 337 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::begin(), remora::compressed_vector< T, I >::end(), and remora::compressed_vector< T, I >::nnz().
|
inline |
Definition at line 271 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::begin(), remora::compressed_vector< T, I >::end(), remora::iterators::compressed_storage_iterator< T, I >::index(), remora::compressed_vector< T, I >::nnz_capacity(), and remora::compressed_vector< T, I >::reserve().
|
inline |
Definition at line 162 of file vector_sparse.hpp.
References remora::compressed_vector< T, I >::nnz_capacity().
|
inline |
Definition at line 152 of file vector_sparse.hpp.
Referenced by remora::compressed_vector< T, I >::operator=(), remora::compressed_vector< T, I >::reserve(), and remora::compressed_vector< T, I >::resize().
|
inline |
Definition at line 239 of file vector_sparse.hpp.
References shark::swap().
Referenced by remora::compressed_vector< T, I >::operator=().
|
friend |
Definition at line 246 of file vector_sparse.hpp.