35#ifndef _BLAZE_MATH_ROW_H_
36#define _BLAZE_MATH_ROW_H_
75class Rand< Row<MT,SO,true,SF,CRAs...> >
84 template<
typename RT >
89 using RowType = RemoveReference_t<RT>;
94 for(
size_t i=0UL; i<
row.size(); ++i ) {
108 template<
typename RT
114 using RowType = RemoveReference_t<RT>;
119 for(
size_t i=0UL; i<
row.size(); ++i ) {
148class Rand< Row<MT,SO,false,SF,CRAs...> >
157 template<
typename RT >
160 using RowType = RemoveReference_t<RT>;
161 using ElementType = ElementType_t<RowType>;
166 const size_t size(
row.size() );
168 if(
size == 0UL )
return;
170 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
173 row.reserve( nonzeros );
175 while(
row.nonZeros() < nonzeros ) {
176 row[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
189 template<
typename RT >
190 inline void randomize( RT&&
row,
size_t nonzeros )
const
192 using RowType = RemoveReference_t<RT>;
193 using ElementType = ElementType_t<RowType>;
198 const size_t size(
row.size() );
200 if( nonzeros >
size ) {
204 if(
size == 0UL )
return;
207 row.reserve( nonzeros );
209 while(
row.nonZeros() < nonzeros ) {
210 row[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
223 template<
typename RT
227 using RowType = RemoveReference_t<RT>;
228 using ElementType = ElementType_t<RowType>;
233 const size_t size(
row.size() );
235 if(
size == 0UL )
return;
237 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
240 row.reserve( nonzeros );
242 while(
row.nonZeros() < nonzeros ) {
243 row[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>(
min,
max );
258 template<
typename RT
260 inline void randomize( RT&&
row,
size_t nonzeros,
const Arg&
min,
const Arg&
max )
const
262 using RowType = RemoveReference_t<RT>;
263 using ElementType = ElementType_t<RowType>;
268 const size_t size(
row.size() );
270 if( nonzeros >
size ) {
274 if(
size == 0UL )
return;
277 row.reserve( nonzeros );
279 while(
row.nonZeros() < nonzeros ) {
280 row[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>(
min,
max );
Header file for auxiliary alias declarations.
Header file for the RemoveReference type trait.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
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
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1380
#define BLAZE_CONSTRAINT_MUST_BE_ROW_TYPE(T)
Constraint on the data type.
Definition: Row.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for the exception macros of the math module.
Header file for the dense vector SMP implementation.
Header file for the sparse vector SMP implementation.
Implementation of a random number generator.
Header file for the implementation of the Column view.
Header file for the implementation of the Row view.