All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StaticVector.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_STATICVECTOR_H_
23 #define _BLAZE_MATH_STATICVECTOR_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
31 #include <blaze/math/DenseVector.h>
33 #include <blaze/system/Precision.h>
34 #include <blaze/util/Random.h>
35 
36 
37 namespace blaze {
38 
39 //=================================================================================================
40 //
41 // RAND SPECIALIZATION
42 //
43 //=================================================================================================
44 
45 //*************************************************************************************************
52 template< typename Type // Data type of the vector
53  , size_t N // Number of elements
54  , bool TF > // Transpose flag
55 class Rand< StaticVector<Type,N,TF> >
56 {
57  public:
58  //**Generate functions**************************************************************************
61  inline const StaticVector<Type,N,TF> generate() const;
62 
63  template< typename Arg >
64  inline const StaticVector<Type,N,TF> generate( const Arg& min, const Arg& max ) const;
66  //**********************************************************************************************
67 
68  //**Randomize functions*************************************************************************
71  inline void randomize( StaticVector<Type,N,TF>& vector ) const;
72 
73  template< typename Arg >
74  inline void randomize( StaticVector<Type,N,TF>& vector, const Arg& min, const Arg& max ) const;
76  //**********************************************************************************************
77 };
79 //*************************************************************************************************
80 
81 
82 //*************************************************************************************************
88 template< typename Type // Data type of the vector
89  , size_t N // Number of elements
90  , bool TF > // Transpose flag
91 inline const StaticVector<Type,N,TF> Rand< StaticVector<Type,N,TF> >::generate() const
92 {
93  StaticVector<Type,N,TF> vector;
94  randomize( vector );
95  return vector;
96 }
98 //*************************************************************************************************
99 
100 
101 //*************************************************************************************************
109 template< typename Type // Data type of the vector
110  , size_t N // Number of elements
111  , bool TF > // Transpose flag
112 template< typename Arg > // Min/max argument type
113 inline const StaticVector<Type,N,TF>
114  Rand< StaticVector<Type,N,TF> >::generate( const Arg& min, const Arg& max ) const
115 {
116  StaticVector<Type,N,TF> vector;
117  randomize( vector, min, max );
118  return vector;
119 }
121 //*************************************************************************************************
122 
123 
124 //*************************************************************************************************
131 template< typename Type // Data type of the vector
132  , size_t N // Number of elements
133  , bool TF > // Transpose flag
134 inline void Rand< StaticVector<Type,N,TF> >::randomize( StaticVector<Type,N,TF>& vector ) const
135 {
136  using blaze::randomize;
137 
138  for( size_t i=0UL; i<N; ++i ) {
139  randomize( vector[i] );
140  }
141 }
143 //*************************************************************************************************
144 
145 
146 //*************************************************************************************************
155 template< typename Type // Data type of the vector
156  , size_t N // Number of elements
157  , bool TF > // Transpose flag
158 template< typename Arg > // Min/max argument type
159 inline void Rand< StaticVector<Type,N,TF> >::randomize( StaticVector<Type,N,TF>& vector,
160  const Arg& min, const Arg& max ) const
161 {
162  using blaze::randomize;
163 
164  for( size_t i=0UL; i<N; ++i ) {
165  randomize( vector[i], min, max );
166  }
167 }
169 //*************************************************************************************************
170 
171 
172 
173 
174 //=================================================================================================
175 //
176 // TYPE DEFINITIONS
177 //
178 //=================================================================================================
179 
180 //*************************************************************************************************
185 //*************************************************************************************************
186 
187 
188 //*************************************************************************************************
193 //*************************************************************************************************
194 
195 
196 //*************************************************************************************************
201 //*************************************************************************************************
202 
203 
204 //*************************************************************************************************
209 //*************************************************************************************************
210 
211 
212 //*************************************************************************************************
217 //*************************************************************************************************
218 
219 
220 //*************************************************************************************************
225 //*************************************************************************************************
226 
227 
228 //*************************************************************************************************
233 //*************************************************************************************************
234 
235 
236 //*************************************************************************************************
241 //*************************************************************************************************
242 
243 
244 //*************************************************************************************************
249 //*************************************************************************************************
250 
251 } // namespace blaze
252 
253 #endif