Blaze 3.9
DynamicVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_DYNAMICVECTOR_H_
36#define _BLAZE_MATH_DYNAMICVECTOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
48#include <blaze/util/Random.h>
49
50
51namespace blaze {
52
53//=================================================================================================
54//
55// RAND SPECIALIZATION
56//
57//=================================================================================================
58
59//*************************************************************************************************
66template< typename Type // Data type of the vector
67 , bool TF // Transpose flag
68 , typename Tag > // Type tag
69class Rand< DynamicVector<Type,TF,Tag> >
70{
71 public:
72 //**********************************************************************************************
78 inline const DynamicVector<Type,TF,Tag> generate( size_t n ) const
79 {
80 DynamicVector<Type,TF,Tag> vector( n );
81 randomize( vector );
82 return vector;
83 }
84 //**********************************************************************************************
85
86 //**********************************************************************************************
94 template< typename Arg > // Min/max argument type
95 inline const DynamicVector<Type,TF,Tag> generate( size_t n, const Arg& min, const Arg& max ) const
96 {
97 DynamicVector<Type,TF,Tag> vector( n );
98 randomize( vector, min, max );
99 return vector;
100 }
101 //**********************************************************************************************
102
103 //**********************************************************************************************
109 inline void randomize( DynamicVector<Type,TF,Tag>& vector ) const
110 {
111 using blaze::randomize;
112
113 const size_t size( vector.size() );
114 for( size_t i=0UL; i<size; ++i ) {
115 randomize( vector[i] );
116 }
117 }
118 //**********************************************************************************************
119
120 //**********************************************************************************************
128 template< typename Arg > // Min/max argument type
129 inline void randomize( DynamicVector<Type,TF,Tag>& vector,
130 const Arg& min, const Arg& max ) const
131 {
132 using blaze::randomize;
133
134 const size_t size( vector.size() );
135 for( size_t i=0UL; i<size; ++i ) {
136 randomize( vector[i], min, max );
137 }
138 }
139 //**********************************************************************************************
140};
142//*************************************************************************************************
143
144} // namespace blaze
145
146#endif
Header file for all basic DenseVector functionality.
Header file for the complete DynamicMatrix implementation.
Header file for the complete ZeroVector implementation.
Header file for the implementation of an arbitrarily sized vector.
Header file for the implementation of a fixed-size 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
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
Implementation of a random number generator.