Blaze 3.9
HybridVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_HYBRIDVECTOR_H_
36#define _BLAZE_MATH_HYBRIDVECTOR_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 , size_t N // Number of elements
68 , bool TF // Transpose flag
69 , AlignmentFlag AF // Alignment flag
70 , PaddingFlag PF // Padding flag
71 , typename Tag > // Type tag
72class Rand< HybridVector<Type,N,TF,AF,PF,Tag> >
73{
74 public:
75 //**********************************************************************************************
81 inline const HybridVector<Type,N,TF,AF,PF,Tag> generate( size_t n ) const
82 {
83 HybridVector<Type,N,TF,AF,PF,Tag> vector( n );
84 randomize( vector );
85 return vector;
86 }
87 //**********************************************************************************************
88
89 //**********************************************************************************************
97 template< typename Arg > // Min/max argument type
98 inline const HybridVector<Type,N,TF,AF,PF,Tag>
99 generate( size_t n, const Arg& min, const Arg& max ) const
100 {
101 HybridVector<Type,N,TF,AF,PF,Tag> vector( n );
102 randomize( vector, min, max );
103 return vector;
104 }
105 //**********************************************************************************************
106
107 //**********************************************************************************************
113 inline void randomize( HybridVector<Type,N,TF,AF,PF,Tag>& vector ) const
114 {
115 using blaze::randomize;
116
117 for( size_t i=0UL; i<vector.size(); ++i ) {
118 randomize( vector[i] );
119 }
120 }
121 //**********************************************************************************************
122
123 //**********************************************************************************************
131 template< typename Arg > // Min/max argument type
132 inline void randomize( HybridVector<Type,N,TF,AF,PF,Tag>& vector,
133 const Arg& min, const Arg& max ) const
134 {
135 using blaze::randomize;
136
137 for( size_t i=0UL; i<vector.size(); ++i ) {
138 randomize( vector[i], min, max );
139 }
140 }
141 //**********************************************************************************************
142};
144//*************************************************************************************************
145
146} // namespace blaze
147
148#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 HybridVector class template.
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
PaddingFlag
Padding flag for (un-)padded vectors and matrices.
Definition: PaddingFlag.h:77
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition: AlignmentFlag.h:63
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
Implementation of a random number generator.