SparseExpression concept
Description
Refinement of
Expression.
Associated types
nnz_type |
The indexing type [1] |
const_nz_reference |
The type of references to a non-zero |
Notation
X |
Type that is a model of SparseExpression |
a |
Objects of type X |
i |
Object of type X::nnz_type |
Definitions
Valid expressions
Name |
Expression |
Type requirements |
Return type |
Number of non-zeros |
a.nnz() |
|
nnz_type |
Non-zero access |
a.nz(i) const |
|
const_nz_reference |
Expression semantics
Name |
Expression |
Precondition |
Semantics |
Postcondition |
Number of non-zeros |
a.nnz() |
|
Returns the number of structural non-zeros |
a.nnz()>=0 |
Non-zero access |
a.nz(i) |
|
Returns the i-th non-zero |
|
Complexity guarantees
Invariants
Models
Notes
[1] The nnz_type
is not necessarily equal to the
size_type
. This is particularly true for sparse vectors of very big sizes
(for which e.g. a 64bit integer is needed to access the elements) but which is very sparse
(and thus where the coordinates of the elements can be stored by means of a 16bit integer).