35 #ifndef _BLAZE_MATH_COLUMN_H_ 36 #define _BLAZE_MATH_COLUMN_H_ 75 class Rand< Column<MT,SO,true,SF,CCAs...> >
81 template<
typename CT >
84 template<
typename CT,
typename Arg >
100 template<
typename MT
104 template<
typename CT >
105 inline void Rand< Column<MT,SO,
true,SF,CCAs...> >
::randomize( CT&&
column )
const 109 using ColumnType = RemoveReference_<CT>;
114 for(
size_t i=0UL; i<
column.size(); ++i ) {
131 template<
typename MT
135 template<
typename CT
137 inline void Rand< Column<MT,SO,
true,SF,CCAs...> >
::randomize( CT&&
column,
const Arg&
min,
const Arg&
max )
const 141 using ColumnType = RemoveReference_<CT>;
146 for(
size_t i=0UL; i<
column.size(); ++i ) {
169 template<
typename MT
173 class Rand< Column<MT,SO,false,SF,CCAs...> >
179 template<
typename CT >
182 template<
typename CT >
185 template<
typename CT,
typename Arg >
186 inline void randomize( CT&&
column,
const Arg& min,
const Arg& max )
const;
188 template<
typename CT,
typename Arg >
189 inline void randomize( CT&&
column,
size_t nonzeros,
const Arg& min,
const Arg& max )
const;
204 template<
typename MT
208 template<
typename CT >
209 inline void Rand< Column<MT,SO,
false,SF,CCAs...> >
::randomize( CT&&
column )
const 211 using ColumnType = RemoveReference_<CT>;
219 if(
size == 0UL )
return;
221 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
224 column.reserve( nonzeros );
226 while(
column.nonZeros() < nonzeros ) {
227 column[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
243 template<
typename MT
247 template<
typename CT >
248 inline void Rand< Column<MT,SO,
false,SF,CCAs...> >
::randomize( CT&&
column,
size_t nonzeros )
const 250 using ColumnType = RemoveReference_<CT>;
258 if( nonzeros >
size ) {
262 if(
size == 0UL )
return;
265 column.reserve( nonzeros );
267 while(
column.nonZeros() < nonzeros ) {
268 column[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
284 template<
typename MT
288 template<
typename CT
290 inline void Rand< Column<MT,SO,
false,SF,CCAs...> >
::randomize( CT&&
column,
const Arg& min,
const Arg& max )
const 292 using ColumnType = RemoveReference_<CT>;
300 if(
size == 0UL )
return;
302 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
305 column.reserve( nonzeros );
307 while(
column.nonZeros() < nonzeros ) {
308 column[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>( min, max );
326 template<
typename MT
330 template<
typename CT
332 inline void Rand< Column<MT,SO,
false,SF,CCAs...> >
::randomize( CT&&
column,
size_t nonzeros,
333 const Arg& min,
const Arg& max )
const 335 using ColumnType = RemoveReference_<CT>;
343 if( nonzeros >
size ) {
347 if(
size == 0UL )
return;
350 column.reserve( nonzeros );
352 while(
column.nonZeros() < nonzeros ) {
353 column[ 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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1234
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:929
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Implementation of a random number generator.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
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
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#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.
Constraint on the data type.
Header file for the implementation of the Column view.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_TYPE(T)
Constraint on the data type.In case the given data type T is not a column type (i.e. a dense or sparse column), a compilation error is created.
Definition: Column.h:61
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.
Header file for the implementation of the Row view.