Blaze 3.9
UniformVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_UNIFORMVECTOR_H_
36#define _BLAZE_MATH_UNIFORMVECTOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
45#include <blaze/util/Random.h>
46#include <blaze/util/Types.h>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// RAND SPECIALIZATION
54//
55//=================================================================================================
56
57//*************************************************************************************************
64template< typename Type // Data type of the vector
65 , bool TF // Transpose flag
66 , typename Tag > // Type tag
67class Rand< UniformVector<Type,TF,Tag> >
68{
69 public:
70 //**********************************************************************************************
76 inline const UniformVector<Type,TF,Tag> generate( size_t n ) const
77 {
78 UniformVector<Type,TF,Tag> vector( n );
79 randomize( vector );
80 return vector;
81 }
82 //**********************************************************************************************
83
84 //**********************************************************************************************
92 template< typename Arg > // Min/max argument type
93 inline const UniformVector<Type,TF,Tag> generate( size_t n, const Arg& min, const Arg& max ) const
94 {
95 UniformVector<Type,TF,Tag> vector( n );
96 randomize( vector, min, max );
97 return vector;
98 }
99 //**********************************************************************************************
100
101 //**********************************************************************************************
107 inline void randomize( UniformVector<Type,TF,Tag>& vector ) const
108 {
109 vector = rand<Type>();
110 }
111 //**********************************************************************************************
112
113 //**********************************************************************************************
121 template< typename Arg > // Min/max argument type
122 inline void randomize( UniformVector<Type,TF,Tag>& vector,
123 const Arg& min, const Arg& max ) const
124 {
125 vector = rand<Type>( min, max );
126 }
127 //**********************************************************************************************
128};
130//*************************************************************************************************
131
132} // namespace blaze
133
134#endif
Header file for all basic DenseVector functionality.
Header file for the implementation of a uniform vector.
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) generate(size_t m, size_t n, OP op)
Generates a new dense matrix filled via the given custom binary operation.
Definition: DMatGenExpr.h:675
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
Implementation of a random number generator.
Header file for basic type definitions.