35 #ifndef _BLAZE_MATH_BAND_H_ 36 #define _BLAZE_MATH_BAND_H_ 74 class Rand< Band<MT,TF,true,MF,CBAs...> >
80 template<
typename BT >
83 template<
typename BT,
typename Arg >
102 , ptrdiff_t... CBAs >
103 template<
typename BT >
104 inline void Rand< Band<MT,TF,
true,MF,CBAs...> >
::randomize( BT&&
band )
const 108 using BandType = RemoveReference_t<BT>;
113 for(
size_t i=0UL; i<
band.size(); ++i ) {
130 template<
typename MT
133 , ptrdiff_t... CBAs >
134 template<
typename BT
136 inline void Rand< Band<MT,TF,
true,MF,CBAs...> >
::randomize( BT&&
band,
const Arg&
min,
const Arg&
max )
const 140 using BandType = RemoveReference_t<BT>;
145 for(
size_t i=0UL; i<
band.size(); ++i ) {
168 template<
typename MT
171 , ptrdiff_t... CBAs >
172 class Rand< Band<MT,TF,false,MF,CBAs...> >
178 template<
typename BT >
181 template<
typename BT >
184 template<
typename BT,
typename Arg >
187 template<
typename BT,
typename Arg >
203 template<
typename MT
206 , ptrdiff_t... CBAs >
207 template<
typename BT >
208 inline void Rand< Band<MT,TF,
false,MF,CBAs...> >
::randomize( BT&&
band )
const 210 using BandType = RemoveReference_t<BT>;
211 using ElementType = ElementType_t<BandType>;
218 if(
size == 0UL )
return;
220 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
223 band.reserve( nonzeros );
225 while(
band.nonZeros() < nonzeros ) {
226 band[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
242 template<
typename MT
245 , ptrdiff_t... CBAs >
246 template<
typename BT >
247 inline void Rand< Band<MT,TF,
false,MF,CBAs...> >
::randomize( BT&&
band,
size_t nonzeros )
const 249 using BandType = RemoveReference_t<BT>;
250 using ElementType = ElementType_t<BandType>;
257 if( nonzeros >
size ) {
261 if(
size == 0UL )
return;
264 band.reserve( nonzeros );
266 while(
band.nonZeros() < nonzeros ) {
267 band[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
283 template<
typename MT
286 , ptrdiff_t... CBAs >
287 template<
typename BT
289 inline void Rand< Band<MT,TF,
false,MF,CBAs...> >
::randomize( BT&&
band,
const Arg&
min,
const Arg&
max )
const 291 using BandType = RemoveReference_t<BT>;
292 using ElementType = ElementType_t<BandType>;
299 if(
size == 0UL )
return;
301 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
304 band.reserve( nonzeros );
306 while(
band.nonZeros() < nonzeros ) {
307 band[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>(
min,
max );
325 template<
typename MT
328 , ptrdiff_t... CBAs >
329 template<
typename BT
331 inline void Rand< Band<MT,TF,
false,MF,CBAs...> >
::randomize( BT&&
band,
size_t nonzeros,
332 const Arg&
min,
const Arg&
max )
const 334 using BandType = RemoveReference_t<BT>;
335 using ElementType = ElementType_t<BandType>;
342 if( nonzeros >
size ) {
346 if(
size == 0UL )
return;
349 band.reserve( nonzeros );
351 while(
band.nonZeros() < nonzeros ) {
352 band[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>(
min,
max );
#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
Header file for auxiliary alias declarations.
Header file for the implementation of the Band view.
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1240
#define BLAZE_CONSTRAINT_MUST_BE_BAND_TYPE(T)
Constraint on the data type.In case the given data type T is not a band type (i.e....
Definition: Band.h:61
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:929
Implementation of a random number generator.
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:292
Header file for the dense vector SMP implementation.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
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:1162
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type,...
Definition: SparseVector.h:61
Constraint on the data type.
Header file for the exception macros of the math module.
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:1198
Constraint on the data type.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:137
Constraint on the data type.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Header file for the RemoveReference type trait.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type,...
Definition: DenseVector.h:61
Header file for the sparse vector SMP implementation.