ALP User Documentation  0.8.preview
Algebraic Programming User Documentation
Public Member Functions | List of all members
Matrix< D, implementation, RowIndexType, ColIndexType, NonzeroIndexType >::const_iterator Class Reference

A standard iterator for an ALP/GraphBLAS matrix. More...

Inherits iterator< std::forward_iterator_tag, std::pair< std::pair< const size_t, const size_t >, const D >, size_t >.

Public Member Functions

bool operator!= (const const_iterator &other) const
 
std::pair< const size_t, const D > operator* () const
 Dereferences the current position of this iterator. More...
 
const_iteratoroperator++ ()
 Advances the position of this iterator by one. More...
 
bool operator== (const const_iterator &other) const
 Standard equals operator. More...
 

Detailed Description

template<typename D, enum Backend implementation, typename RowIndexType, typename ColIndexType, typename NonzeroIndexType>
class grb::Matrix< D, implementation, RowIndexType, ColIndexType, NonzeroIndexType >::const_iterator

A standard iterator for an ALP/GraphBLAS matrix.

This iterator is used for data extraction only. Hence only this const version is specified.

Dereferencing an iterator of this type that is not in end position yields a pair \( (c,v) \). The value v is of type D and corresponds to the value of the dereferenced nonzero.

The value c is another pair \( (i,j) \). The values i and j are of type size_t and correspond to the coordinate of the dereferenced nonzero.

Note
‘Pair’ here corresponds to the regular std::pair.
Warning
Comparing two const iterators corresponding to different containers leads to undefined behaviour.
Advancing an iterator past the end iterator of the container it corresponds to, leads to undefined behaviour.
Modifying the contents of a container makes any use of any iterator derived from it incur invalid behaviour.
Note
These are standard limitations of STL iterators.

In terms of STL, the returned iterator is an forward iterator. Its performance semantics match that defined by the STL. Backends are encouraged to specify additional performance semantics as long as they do not conflict with those of a forward iterator.

Backends are allowed to return bi-directional or random access iterators instead of forward iterators.

Member Function Documentation

◆ operator!=()

bool operator!= ( const const_iterator other) const
inline
Returns
The negation of operator==()

◆ operator*()

std::pair< const size_t, const D > operator* ( ) const
inline

Dereferences the current position of this iterator.

Returns
If this iterator is valid and not in end position, this returns an std::pair with in its first field the position of the nonzero value, and in its second field the value of the nonzero. The position of a nonzero is another std::pair with both the first and second field of type size_t.
Note
If this iterator is invalid or in end position, the result is undefined.

◆ operator++()

const_iterator& operator++ ( )
inline

Advances the position of this iterator by one.

If the current position corresponds to the last element in the container, the new position of this iterator will be its end position.

If the current position of this iterator is already the end position, this iterator will become invalid; any use of invalid iterators will lead to undefined behaviour.

Returns
A reference to this iterator.

◆ operator==()

bool operator== ( const const_iterator other) const
inline

Standard equals operator.

Returns
Whether this iterator and the given other iterator are the same.

The documentation for this class was generated from the following file: