35#ifndef _BLAZE_UTIL_INDICES_H_
36#define _BLAZE_UTIL_INDICES_H_
84 inline size_t size () const noexcept;
122template< typename T >
130 const T maxNumber(
max + T(1) -
min );
132 if( number > maxNumber ) {
136 if( number == 0UL ) {
140 if( number <= T( maxNumber * 0.5 ) )
146 const T value = rand<T>(
min,
max);
148 const auto pos = std::lower_bound(
indices_.begin(),
indices_.end(), value );
150 if( pos ==
indices_.end() || *pos != value ) {
162 const T value = rand<T>(
min,
max);
164 const auto pos = std::lower_bound(
indices_.begin(),
indices_.end(), value );
166 if( pos !=
indices_.end() && *pos == value ) {
188template<
typename T >
201template<
typename T >
214template<
typename T >
Auxiliary class for the generation of random indices.
Definition: Indices.h:67
typename std::vector< T >::const_iterator ConstIterator
Iterator over the generated indices.
Definition: Indices.h:71
ConstIterator begin() const noexcept
Returns an iterator to the beginning of the vector.
Definition: Indices.h:202
size_t size() const noexcept
Returns the total number of random indices.
Definition: Indices.h:189
std::vector< T > indices_
The generated indices.
Definition: Indices.h:94
Indices(T min, T max, T number)
The constructor for the Indices class.
Definition: Indices.h:123
ConstIterator end() const noexcept
Returns an iterator just past the last element of the vector.
Definition: Indices.h:215
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for exception macros.
Implementation of a random number generator.
Header file for basic type definitions.