|
Int | dim () const |
| tell the current vector dimension, i.e., the number of non-zero elements (may differ from size)
|
|
| SparseVector () |
| create as empty
|
|
| SparseVector (Int dim_arg) |
| create vector of length n, (implicitly) initialize all elements with 0
|
|
template<typename Iterator , bool enabled = construct_sparse_iterator<Iterator, E>::enabled> |
| SparseVector (Int dim_arg, Iterator &&src) |
|
| SparseVector (const GenericVector< SparseVector > &v) |
| Copy of a disguised SparseVector object.
|
|
template<typename Vector2 > |
| SparseVector (const GenericVector< Vector2, E > &v) |
| Create a vector as a copy of another vector of the same element type.
|
|
template<typename Vector2 , typename E2 > |
| SparseVector (const GenericVector< Vector2, E2 > &v, std::enable_if_t< can_initialize< E2, E >::value, std::nullptr_t >=nullptr) |
| Create a vector as a copy of another vector with a different element type.
|
|
template<typename E2 , typename = std::enable_if_t<can_initialize<E2, E>::value>> |
| SparseVector (std::initializer_list< E2 > l) |
|
| SparseVector (Int d, std::initializer_list< std::pair< Int, E >> l) |
|
void | clear () |
| truncate to zero size
|
|
void | resize (Int n) |
| change the size, initialize appended elements with default constructor
|
|
reference | operator[] (Int i) |
| random access, may cost O(log(n)) time; Performance Comparison of Vector Classes
|
|
const E & | operator[] (Int i) const |
| constant random access, may cost O(log(n)) time; Performance Comparison of Vector Classes
|
|
template<typename Vector2 , typename E2 , typename = std::enable_if_t<can_initialize<E2, E>::value>> |
SparseVector & | operator|= (const GenericVector< Vector2, E2 > &v) |
| append a GenericVector
|
|
template<typename E2 , typename = std::enable_if_t<can_initialize<E2, E>::value>> |
SparseVector & | operator|= (E2 &&r) |
| append an element
|
|
template<typename E2 , typename = std::enable_if_t<can_initialize<E2, E>::value>> |
SparseVector & | operator|= (std::initializer_list< E2 > l) |
|
template<typename E>
class pm::SparseVector< E >
Vector type class which is an associative container with element indices (coordinates) as keys; elements equal to the default value (ElementType()
, which is 0 for most numerical types) are not stored, but implicitly encoded by the gaps in the key set. It is based on an AVL tree.
template<typename E >
template<typename Iterator , bool enabled = construct_sparse_iterator<Iterator, E>::enabled>
Create a vector of dimension n, initialize the elements from a data sequence. Iterator can be either indexed, or supply index-value pairs, e.g. std::pair<Int, ElementType> or a plain sequence of data items. In the latter case zero elements are filtered out.