Blaze 3.9
Public Types | List of all members
blaze::Indices< T > Class Template Reference

Auxiliary class for the generation of random indices. More...

#include <Indices.h>

Public Types

using ConstIterator = typename std::vector< T >::const_iterator
 Iterator over the generated indices.
 

Public Member Functions

Constructors
 Indices (T min, T max, T number)
 The constructor for the Indices class. More...
 
Utility functions
size_t size () const noexcept
 Returns the total number of random indices. More...
 
ConstIterator begin () const noexcept
 Returns an iterator to the beginning of the vector. More...
 
ConstIterator end () const noexcept
 Returns an iterator just past the last element of the vector. More...
 

Private Attributes

Member variables
std::vector< T > indices_
 The generated indices.
 

Detailed Description

template<typename T>
class blaze::Indices< T >

Auxiliary class for the generation of random indices.

This auxiliary class can be used to generate a set of random indices.

Constructor & Destructor Documentation

◆ Indices()

template<typename T >
blaze::Indices< T >::Indices ( min,
max,
number 
)
inline

The constructor for the Indices class.

Parameters
minThe lower limit of the random indices.
maxThe upper limit of the random indices.
numberThe number of random indices to generate.
Exceptions
std::invalid_argumentInvalid index range.
std::invalid_argumentInvalid number of indices.

This constructor initializes an Indices object by generating number random, unique indices in the range min to max. In case number is larger than the possible number of incides in the specified range, a std::invalid_argument exception is thrown.

Member Function Documentation

◆ begin()

template<typename T >
Indices< T >::ConstIterator blaze::Indices< T >::begin
inlinenoexcept

Returns an iterator to the beginning of the vector.

Returns
Iterator to the beginning of the vector.

◆ end()

template<typename T >
Indices< T >::ConstIterator blaze::Indices< T >::end
inlinenoexcept

Returns an iterator just past the last element of the vector.

Returns
Iterator just past the last element of the vector.

◆ size()

template<typename T >
size_t blaze::Indices< T >::size
inlinenoexcept

Returns the total number of random indices.

Returns
The total number of random indices.

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