35#ifndef _BLAZE_MATH_COLUMNS_H_
36#define _BLAZE_MATH_COLUMNS_H_
75class Rand< Columns<MT,SO,true,SF,CCAs...> >
84 template<
typename CT >
89 using ColumnsType = RemoveReference_t<CT>;
95 for(
size_t i=0UL; i<
columns.rows(); ++i ) {
96 for(
size_t j=0UL; j<
columns.columns(); ++j ) {
102 for(
size_t j=0UL; j<
columns.columns(); ++j ) {
103 for(
size_t i=0UL; i<
columns.rows(); ++i ) {
119 template<
typename CT
125 using ColumnsType = RemoveReference_t<CT>;
131 for(
size_t i=0UL; i<
columns.rows(); ++i ) {
132 for(
size_t j=0UL; j<
columns.columns(); ++j ) {
138 for(
size_t j=0UL; j<
columns.columns(); ++j ) {
139 for(
size_t i=0UL; i<
columns.rows(); ++i ) {
170class Rand< Columns<MT,SO,false,SF,CCAs...> >
179 template<
typename CT >
182 using ColumnsType = RemoveReference_t<CT>;
183 using ElementType = ElementType_t<ColumnsType>;
188 const size_t m(
columns.rows() );
189 const size_t n(
columns.columns() );
191 if( m == 0UL || n == 0UL )
return;
193 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*m*n ) ) );
198 while(
columns.nonZeros() < nonzeros ) {
199 columns( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-1UL ) ) = rand<ElementType>();
212 template<
typename CT >
215 using ColumnsType = RemoveReference_t<CT>;
216 using ElementType = ElementType_t<ColumnsType>;
221 const size_t m(
columns.rows() );
222 const size_t n(
columns.columns() );
224 if( nonzeros > m*n ) {
228 if( m == 0UL || n == 0UL )
return;
233 while(
columns.nonZeros() < nonzeros ) {
234 columns( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-1UL ) ) = rand<ElementType>();
247 template<
typename CT
251 using ColumnsType = RemoveReference_t<CT>;
252 using ElementType = ElementType_t<ColumnsType>;
257 const size_t m(
columns.rows() );
258 const size_t n(
columns.columns() );
260 if( m == 0UL || n == 0UL )
return;
262 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*m*n ) ) );
267 while(
columns.nonZeros() < nonzeros ) {
268 columns( rand<size_t>( 0UL, m-1UL ), rand<size_t>( 0UL, n-1UL ) ) = rand<ElementType>(
min,
max );
283 template<
typename CT
287 using ColumnsType = RemoveReference_t<CT>;
288 using ElementType = ElementType_t<ColumnsType>;
293 const size_t m(
columns.rows() );
294 const size_t n(
columns.columns() );
296 if( nonzeros > m*n ) {
300 if( m == 0UL || n == 0UL )
return;
305 while(
columns.nonZeros() < nonzeros ) {
306 columns( 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) columns(MT &&matrix, const std::vector< T > &indices, RCAs... args)
Creating a view on a selection of columns of the given matrix.
Definition: Columns.h:703
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_COLUMNS_TYPE(T)
Constraint on the data type.
Definition: Columns.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
#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.