35 #ifndef _BLAZE_UTIL_INDICES_H_
36 #define _BLAZE_UTIL_INDICES_H_
86 inline size_t size ()
const;
87 inline ConstIterator
begin()
const;
88 inline ConstIterator
end ()
const;
131 const size_t maxNumber( max + 1UL - min );
133 if( number > maxNumber ) {
137 if( number == 0UL ) {
141 if( number <=
size_t( maxNumber * 0.5 ) )
147 const size_t value = rand<size_t>(
min,
max);
149 const auto pos = std::lower_bound(
indices_.begin(),
indices_.end(), value );
151 if( pos ==
indices_.end() || *pos != value ) {
163 const size_t value = rand<size_t>(
min,
max);
165 const auto pos = std::lower_bound(
indices_.begin(),
indices_.end(), value );
167 if( pos !=
indices_.end() && *pos == value ) {
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Auxiliary class for the generation of random indices.
Definition: Indices.h:65
Header file for basic type definitions.
std::vector< size_t >::const_iterator ConstIterator
Iterator over the generated indices.
Definition: Indices.h:69
Header file for exception macros.
Indices(size_t min, size_t max, size_t number)
The constructor for the Indices class.
Definition: Indices.h:124
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Implementation of a random number generator.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
size_t size() const
Returns the total number of random indices.
Definition: Indices.h:189
std::vector< size_t > indices_
The generated indices.
Definition: Indices.h:96
ConstIterator begin() const
Returns an iterator to the beginning of the vector.
Definition: Indices.h:201
ConstIterator end() const
Returns an iterator just past the last element of the vector.
Definition: Indices.h:213
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101