ALP User Documentation  0.8.preview
Algebraic Programming User Documentation
Public Types | Static Public Member Functions | List of all members
Sequence< T > Class Template Reference

An iterator over a collection of \( c \) items that for each item \( i \in \{0,1,\dots,c-1\} \) returns \( f(i) \), where \( f \) is of the form \( o + s( \lfloor i/r \rfloor ) \). More...

Public Types

typedef grb::utils::internal::PosBasedIterator< T, std::tuple< size_t, size_t, size_t >, Sequence< T > > RealType
 The return type of the factory methods.
 

Static Public Member Functions

static RealType make_iterator (const size_t count, const bool start, const size_t offset=static_cast< size_t >(0), const size_t stride=static_cast< size_t >(1), const size_t repetitions=static_cast< size_t >(1), T dummy=T(), const size_t s=0, const size_t P=1)
 Constructs an iterator over a given sequence. More...
 

Detailed Description

template<typename T>
class grb::utils::iterators::Sequence< T >

An iterator over a collection of \( c \) items that for each item \( i \in \{0,1,\dots,c-1\} \) returns \( f(i) \), where \( f \) is of the form \( o + s( \lfloor i/r \rfloor ) \).

In this formula,

  1. \( o \) is the offset;
  2. \( s \) is the stride; and
  3. \( r \) is the number of repetitions of the same value.
Template Parameters
TThe value type of the iterator, i.e., the type returned by \( f \).

This class implements a factory for retrieving sequence iterators.

Rather than using sequence iterators directly, however, users may consider referring to grb::utils::containers::Range instead.

Member Function Documentation

◆ make_iterator()

static RealType make_iterator ( const size_t  count,
const bool  start,
const size_t  offset = static_cast< size_t >( 0 ),
const size_t  stride = static_cast< size_t >( 1 ),
const size_t  repetitions = static_cast< size_t >( 1 ),
dummy = T(),
const size_t  s = 0,
const size_t  P = 1 
)
inlinestatic

Constructs an iterator over a given sequence.

Parameters
[in]countThe number of elements in the sequence.
[in]startWhether the iterator is in start position (or in end position instead).
[in]offsetThe first element in the sequence.
[in]strideThe distance between two elements in the sequence.
[in]repetitionsThe number of times each element is repeated.
[in]dummyA dummy initialiser for return elements; optional, in case T is not default-constructible.

The following are optional arguments for optionally creating parallel I/O iterators:

Parameters
[in]sThe process ID; default is zero.
[in]PThe number of processes; default is one.

The parameter s must be strictly smaller than P, and P must be larger than zero.


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