ALP User Documentation
0.8.preview
Algebraic Programming User Documentation
|
A container that contains a sequence of numbers with a given stride, and optionally a given number of repetitions. More...
Public Types | |
typedef iterator | const_iterator |
The const-iterator type. | |
typedef grb::utils::iterators::Sequence< T >::RealType | iterator |
The iterator type. More... | |
Public Member Functions | |
Range (const size_t start, const size_t end, const size_t stride=static_cast< size_t >(1), const size_t repetitions=static_cast< size_t >(1)) noexcept | |
Constructs a range. More... | |
iterator | begin (const size_t s=0, const size_t P=1) const |
Returns a const-iterator at start position to this container. More... | |
const_iterator | cbegin (const size_t s=0, const size_t P=1) const |
Returns a const-iterator at start position to this container. More... | |
const_iterator | cend (const size_t s=0, const size_t P=1) const |
Returns a const-iterator at end position to this container. More... | |
iterator | end (const size_t s=0, const size_t P=1) const |
Returns a const-iterator at end position to this container. More... | |
A container that contains a sequence of numbers with a given stride, and optionally a given number of repetitions.
T | The type of numbers; optional, default is size_t . |
The storage of this container is \( \Theta(1) \).
This is an unmodifiable (const) container.
typedef grb::utils::iterators::Sequence< T >::RealType iterator |
The iterator type.
|
inlinenoexcept |
Constructs a range.
[in] | start | The start of the range (inclusive) |
[in] | end | The end of the range (exclusive) |
[in] | stride | The stride of the range (optional, default is 1) |
[in] | repetitions | The number of repetitions of each value (optional, default is 1) |
The value end must be larger than or equal to start. Equal values for start and end result in an empty range. A larger value for end than start will result in a range consisting at least one element (start).
The range \( (1, 3, 5, 7, 9) \) may be constructed by start 1, end 11, stride 2 and repetitions 1.
The range \( (1, 1, 2, 2, 3, 3) \) may be constructed by start 1, end 4, stride 1 and repetitions 2.
|
inline |
Returns a const-iterator at start position to this container.
By default, it creates a sequential I/O iterator, meaning, an iterator that iterators over all elements in the container. Optionally, however, the callee may request an iterator over a chunk of this container instead:
[in] | s | The chunk ID of the requested chunk. |
[in] | P | How many chunks the underlying container should be cut into. |
The defaults for s and P are 0 and 1, respectively. The value s must always be strictly smaller than P, and P must always be strictly larger than zero.
For \( P > 1 \), the iterator may be used to effect parallel I/O. With parallel I/O, multiple threads and/or processes may concurrently deal with different chunks of this container.
An iterator pair retrieved in this mode only has knowledge about the elements in its chunk of the container; the size of the container as visible by the iterator pair thus reflects the size of the chunk, not that of the container.
Thus as an addition to standard STL semenatics, iterator pairs when jointly passed to some STL (or ALP) call must not only be derived from the same container, but must be derived from the same chunk as well.
|
inline |
Returns a const-iterator at start position to this container.
Since this container is immutable, there is no difference between this function (cbegin) and begin. Please see the latter for full documentation.
|
inline |
Returns a const-iterator at end position to this container.
Since this container is immutable, there is no difference between this function (cend) and end. Please see the latter for full documentation.
|
inline |
Returns a const-iterator at end position to this container.
By default, it creates a sequential I/O iterator, meaning, an iterator that iterators over all elements in the container. Optionally, however, the callee may request an iterator over a chunk of this container instead:
[in] | s | The chunk ID of the requested chunk. |
[in] | P | How many chunks the underlying container should be cut into. |
The defaults for s and P are 0 and 1, respectively. The value s must always be strictly smaller than P, and P must always be strictly larger than zero.
For \( P > 1 \), the iterator may be used to effect parallel I/O. With parallel I/O, multiple threads and/or processes may concurrently deal with different chunks of this container.
An iterator pair retrieved in this mode only has knowledge about the elements in its chunk of the container; the size of the container as visible by the iterator pair thus reflects the size of the chunk, not that of the container.
Thus as an addition to standard STL semenatics, iterator pairs when jointly passed to some STL (or ALP) call must not only be derived from the same container, but must be derived from the same chunk as well.