35 #ifndef _BLAZE_MATH_COLUMN_H_
36 #define _BLAZE_MATH_COLUMN_H_
70 class Rand< Column<MT,SO,true,SF> >
78 template<
typename Arg >
97 inline void Rand< Column<MT,SO,true,SF> >
::randomize( Column<MT,SO,true,SF>&
column )
const
101 for(
size_t i=0UL; i<column.size(); ++i ) {
118 template<
typename MT
121 template<
typename Arg >
122 inline void Rand< Column<MT,SO,true,SF> >
::randomize( Column<MT,SO,true,SF>& column,
123 const Arg&
min,
const Arg&
max )
const
127 for(
size_t i=0UL; i<column.size(); ++i ) {
150 template<
typename MT
153 class Rand< Column<MT,SO,false,SF> >
159 inline void randomize( Column<MT,SO,false,SF>& column )
const;
160 inline void randomize( Column<MT,SO,false,SF>& column,
size_t nonzeros )
const;
162 template<
typename Arg >
163 inline void randomize( Column<MT,SO,false,SF>& column,
const Arg& min,
const Arg& max )
const;
165 template<
typename Arg >
166 inline void randomize( Column<MT,SO,false,SF>& column,
size_t nonzeros,
const Arg& min,
const Arg& max )
const;
181 template<
typename MT
184 inline void Rand< Column<MT,SO,false,SF> >
::randomize( Column<MT,SO,false,SF>& column )
const
186 typedef ElementType_< Column<MT,SO,false,SF> >
ElementType;
188 const size_t size( column.size() );
190 if(
size == 0UL )
return;
192 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
195 column.reserve( nonzeros );
197 while( column.nonZeros() < nonzeros ) {
198 column[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
214 template<
typename MT
217 inline void Rand< Column<MT,SO,false,SF> >
::randomize( Column<MT,SO,false,SF>& column,
size_t nonzeros )
const
219 typedef ElementType_< Column<MT,SO,false,SF> >
ElementType;
221 const size_t size( column.size() );
223 if( nonzeros >
size ) {
227 if(
size == 0UL )
return;
230 column.reserve( nonzeros );
232 while( column.nonZeros() < nonzeros ) {
233 column[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
249 template<
typename MT
252 template<
typename Arg >
253 inline void Rand< Column<MT,SO,false,SF> >
::randomize( Column<MT,SO,false,SF>& column,
254 const Arg& min,
const Arg& max )
const
256 typedef ElementType_< Column<MT,SO,false,SF> >
ElementType;
258 const size_t size( column.size() );
260 if(
size == 0UL )
return;
262 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
265 column.reserve( nonzeros );
267 while( column.nonZeros() < nonzeros ) {
268 column[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>( min, max );
286 template<
typename MT
289 template<
typename Arg >
290 inline void Rand< Column<MT,SO,false,SF> >
::randomize( Column<MT,SO,false,SF>& column,
size_t nonzeros,
291 const Arg& min,
const Arg& max )
const
293 typedef ElementType_< Column<MT,SO,false,SF> >
ElementType;
295 const size_t size( column.size() );
297 if( nonzeros >
size ) {
301 if(
size == 0UL )
return;
304 column.reserve( nonzeros );
306 while( column.nonZeros() < nonzeros ) {
307 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.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:926
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
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:1716
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
Header file for the dense vector SMP implementation.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:289
Header file for the exception macros of the math module.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Header file for all restructuring column functions.
Header file for the sparse vector SMP implementation.
Header file for the implementation of the Row view.
const DMatForEachExpr< MT, Ceil, SO > ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1130