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

A (dense) vector of a given size that holds the same constant value at each entry. More...

Public Types

typedef iterator const_iterator
 The const-iterator type.
 
typedef grb::utils::iterators::Repeater< T >::RealType iterator
 The iterator type. More...
 

Public Member Functions

 ConstantVector (const T val, const size_t n)
 Constructs a container with \( \Theta(1) \) memory usage that represents some vector of length n with contents \( ( c, c, \ldots, c ) \). 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...
 

Detailed Description

template<typename T>
class grb::utils::containers::ConstantVector< T >

A (dense) vector of a given size that holds the same constant value at each entry.

Instances of this container are immutable in terms of both value and size.

Template Parameters
TThe type of the value.

The storage requirement of this container is \( \Theta(1) \).

Member Typedef Documentation

◆ iterator

typedef grb::utils::iterators::Repeater< T >::RealType iterator

The iterator type.

Constructor & Destructor Documentation

◆ ConstantVector()

ConstantVector ( const T  val,
const size_t  n 
)
inline

Constructs a container with \( \Theta(1) \) memory usage that represents some vector of length n with contents \( ( c, c, \ldots, c ) \).

Parameters
[in]valThe value of the constants \( c \) in this vector.
[in]nThe size of the vector.

Member Function Documentation

◆ begin()

iterator begin ( const size_t  s = 0,
const size_t  P = 1 
) const
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:

Parameters
[in]sThe chunk ID of the requested chunk.
[in]PHow 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.

◆ cbegin()

const_iterator cbegin ( const size_t  s = 0,
const size_t  P = 1 
) const
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.

◆ cend()

const_iterator cend ( const size_t  s = 0,
const size_t  P = 1 
) const
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.

◆ end()

iterator end ( const size_t  s = 0,
const size_t  P = 1 
) const
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:

Parameters
[in]sThe chunk ID of the requested chunk.
[in]PHow 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.


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