35#ifndef _BLAZE_MATH_ROWS_H_
36#define _BLAZE_MATH_ROWS_H_
75class Rand< Rows<MT,SO,true,SF,CRAs...> >
84 template<
typename RT >
89 using RowsType = RemoveReference_t<RT>;
95 for(
size_t i=0UL; i<
rows.rows(); ++i ) {
96 for(
size_t j=0UL; j<
rows.columns(); ++j ) {
102 for(
size_t j=0UL; j<
rows.columns(); ++j ) {
103 for(
size_t i=0UL; i<
rows.rows(); ++i ) {
119 template<
typename RT
125 using RowsType = RemoveReference_t<RT>;
131 for(
size_t i=0UL; i<
rows.rows(); ++i ) {
132 for(
size_t j=0UL; j<
rows.columns(); ++j ) {
138 for(
size_t j=0UL; j<
rows.columns(); ++j ) {
139 for(
size_t i=0UL; i<
rows.rows(); ++i ) {
170class Rand< Rows<MT,SO,false,SF,CRAs...> >
179 template<
typename RT >
182 using RowsType = RemoveReference_t<RT>;
183 using ElementType = ElementType_t<RowsType>;
188 const size_t m(
rows.rows() );
189 const size_t n(
rows.columns() );
191 if( m == 0UL || n == 0UL )
return;
193 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*m*n ) ) );
196 rows.reserve( nonzeros );
198 while(
rows.nonZeros() < nonzeros ) {
199 rows( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-1UL ) ) = rand<ElementType>();
212 template<
typename RT >
215 using RowsType = RemoveReference_t<RT>;
216 using ElementType = ElementType_t<RowsType>;
221 const size_t m(
rows.rows() );
222 const size_t n(
rows.columns() );
224 if( nonzeros > m*n ) {
228 if( m == 0UL || n == 0UL )
return;
231 rows.reserve( nonzeros );
233 while(
rows.nonZeros() < nonzeros ) {
234 rows( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-1UL ) ) = rand<ElementType>();
247 template<
typename RT
251 using RowsType = RemoveReference_t<RT>;
252 using ElementType = ElementType_t<RowsType>;
257 const size_t m(
rows.rows() );
258 const size_t n(
rows.columns() );
260 if( m == 0UL || n == 0UL )
return;
262 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*m*n ) ) );
265 rows.reserve( nonzeros );
267 while(
rows.nonZeros() < nonzeros ) {
268 rows( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-1UL ) ) = rand<ElementType>(
min,
max );
283 template<
typename RT
287 using RowsType = RemoveReference_t<RT>;
288 using ElementType = ElementType_t<RowsType>;
293 const size_t m(
rows.rows() );
294 const size_t n(
rows.columns() );
296 if( nonzeros > m*n ) {
300 if( m == 0UL || n == 0UL )
return;
303 rows.reserve( nonzeros );
305 while(
rows.nonZeros() < nonzeros ) {
306 rows( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-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_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ROWS_TYPE(T)
Constraint on the data type.
Definition: Rows.h:61
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
decltype(auto) rows(MT &&matrix, const SmallArray< T, N > &indices, RRAs... args)
Creating a view on a selection of rows of the given matrix.
Definition: Rows.h:753
#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 matrix SMP implementation.
Header file for the sparse matrix SMP implementation.
Implementation of a random number generator.
Header file for the implementation of the Columns view.
Header file for the implementation of the Rows view.