35#ifndef _BLAZE_MATH_SUBMATRIX_H_
36#define _BLAZE_MATH_SUBMATRIX_H_
75class Rand< Submatrix<MT,AF,SO,true,CSAs...> >
84 template<
typename SMT >
94 if( SO == rowMajor ) {
95 for(
size_t i=0UL; i<
submatrix.rows(); ++i ) {
96 for(
size_t j=0UL; j<
submatrix.columns(); ++j ) {
102 for(
size_t j=0UL; j<
submatrix.columns(); ++j ) {
103 for(
size_t i=0UL; i<
submatrix.rows(); ++i ) {
119 template<
typename SMT
130 if( SO == rowMajor ) {
131 for(
size_t i=0UL; i<
submatrix.rows(); ++i ) {
132 for(
size_t j=0UL; j<
submatrix.columns(); ++j ) {
138 for(
size_t j=0UL; j<
submatrix.columns(); ++j ) {
139 for(
size_t i=0UL; i<
submatrix.rows(); ++i ) {
170class Rand< Submatrix<MT,AF,SO,false,CSAs...> >
179 template<
typename SMT >
183 using ElementType = ElementType_t<SubmatrixType>;
191 if( m == 0UL || n == 0UL )
return;
193 const size_t nonzeros(
rand<size_t>( 1UL, std::ceil( 0.5*m*n ) ) );
198 while(
submatrix.nonZeros() < nonzeros ) {
212 template<
typename SMT >
216 using ElementType = ElementType_t<SubmatrixType>;
224 if( nonzeros > m*n ) {
228 if( m == 0UL || n == 0UL )
return;
233 while(
submatrix.nonZeros() < nonzeros ) {
247 template<
typename SMT
252 using ElementType = ElementType_t<SubmatrixType>;
260 if( m == 0UL || n == 0UL )
return;
262 const size_t nonzeros(
rand<size_t>( 1UL, std::ceil( 0.5*m*n ) ) );
267 while(
submatrix.nonZeros() < nonzeros ) {
283 template<
typename SMT
288 using ElementType = ElementType_t<SubmatrixType>;
296 if( nonzeros > m*n ) {
300 if( m == 0UL || n == 0UL )
return;
305 while(
submatrix.nonZeros() < nonzeros ) {
Header file for auxiliary alias declarations.
Header file for the RemoveReference type trait.
Default implementation of the Rand class.
Definition Random.h:230
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
#define BLAZE_CONSTRAINT_MUST_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.
Definition Submatrix.h:61
#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
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition AlignmentFlag.h:63
T rand()
Random number function.
Definition Random.h:583
void randomize(T &&value)
Randomization of a given variable.
Definition Random.h:626
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition Submatrix.h:181
typename RemoveReference< T >::Type RemoveReference_t
Auxiliary alias declaration for the RemoveReference type trait.
Definition RemoveReference.h:95
#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 Submatrix view.
Header file for the implementation of the Subvector view.