All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StaticVector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_STATICVECTOR_H_
36 #define _BLAZE_MATH_STATICVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/DenseVector.h>
47 #include <blaze/system/Precision.h>
48 #include <blaze/util/Random.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // RAND SPECIALIZATION
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
66 template< typename Type // Data type of the vector
67  , size_t N // Number of elements
68  , bool TF > // Transpose flag
69 class Rand< StaticVector<Type,N,TF> >
70 {
71  public:
72  //**Generate functions**************************************************************************
75  inline const StaticVector<Type,N,TF> generate() const;
76 
77  template< typename Arg >
78  inline const StaticVector<Type,N,TF> generate( const Arg& min, const Arg& max ) const;
80  //**********************************************************************************************
81 
82  //**Randomize functions*************************************************************************
85  inline void randomize( StaticVector<Type,N,TF>& vector ) const;
86 
87  template< typename Arg >
88  inline void randomize( StaticVector<Type,N,TF>& vector, const Arg& min, const Arg& max ) const;
90  //**********************************************************************************************
91 };
93 //*************************************************************************************************
94 
95 
96 //*************************************************************************************************
102 template< typename Type // Data type of the vector
103  , size_t N // Number of elements
104  , bool TF > // Transpose flag
105 inline const StaticVector<Type,N,TF> Rand< StaticVector<Type,N,TF> >::generate() const
106 {
107  StaticVector<Type,N,TF> vector;
108  randomize( vector );
109  return vector;
110 }
112 //*************************************************************************************************
113 
114 
115 //*************************************************************************************************
123 template< typename Type // Data type of the vector
124  , size_t N // Number of elements
125  , bool TF > // Transpose flag
126 template< typename Arg > // Min/max argument type
127 inline const StaticVector<Type,N,TF>
128  Rand< StaticVector<Type,N,TF> >::generate( const Arg& min, const Arg& max ) const
129 {
130  StaticVector<Type,N,TF> vector;
131  randomize( vector, min, max );
132  return vector;
133 }
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
145 template< typename Type // Data type of the vector
146  , size_t N // Number of elements
147  , bool TF > // Transpose flag
148 inline void Rand< StaticVector<Type,N,TF> >::randomize( StaticVector<Type,N,TF>& vector ) const
149 {
150  using blaze::randomize;
151 
152  for( size_t i=0UL; i<N; ++i ) {
153  randomize( vector[i] );
154  }
155 }
157 //*************************************************************************************************
158 
159 
160 //*************************************************************************************************
169 template< typename Type // Data type of the vector
170  , size_t N // Number of elements
171  , bool TF > // Transpose flag
172 template< typename Arg > // Min/max argument type
173 inline void Rand< StaticVector<Type,N,TF> >::randomize( StaticVector<Type,N,TF>& vector,
174  const Arg& min, const Arg& max ) const
175 {
176  using blaze::randomize;
177 
178  for( size_t i=0UL; i<N; ++i ) {
179  randomize( vector[i], min, max );
180  }
181 }
183 //*************************************************************************************************
184 
185 
186 
187 
188 //=================================================================================================
189 //
190 // TYPE DEFINITIONS
191 //
192 //=================================================================================================
193 
194 //*************************************************************************************************
199 //*************************************************************************************************
200 
201 
202 //*************************************************************************************************
207 //*************************************************************************************************
208 
209 
210 //*************************************************************************************************
215 //*************************************************************************************************
216 
217 
218 //*************************************************************************************************
223 //*************************************************************************************************
224 
225 
226 //*************************************************************************************************
231 //*************************************************************************************************
232 
233 
234 //*************************************************************************************************
239 //*************************************************************************************************
240 
241 
242 //*************************************************************************************************
247 //*************************************************************************************************
248 
249 
250 //*************************************************************************************************
255 //*************************************************************************************************
256 
257 
258 //*************************************************************************************************
263 //*************************************************************************************************
264 
265 } // namespace blaze
266 
267 #endif
Header file for the implementation of a fixed-size vector.
StaticVector< real, 3UL, false > Vec3
3-dimensional vector with system-specific precision.
Definition: StaticVector.h:238
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:1043
StaticVector< real, 6UL, false > Vec6
6-dimensional vector with system-specific precision.
Definition: StaticVector.h:262
StaticVector< float, 2UL, false > Vec2f
2-dimensional single precision vector.
Definition: StaticVector.h:198
Implementation of a random number generator.
StaticVector< double, 2UL, false > Vec2d
2-dimensional double precision vector.
Definition: StaticVector.h:206
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:52
Header file for the floating point precision of the Blaze library.
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:262
StaticVector< double, 3UL, false > Vec3d
3-dimensional double precision vector.
Definition: StaticVector.h:230
Header file for the complete DynamicVector implementation.
StaticVector< real, 2UL, false > Vec2
2-dimensional vector with system-specific precision.
Definition: StaticVector.h:214
Header file for all basic DenseVector functionality.
T generate() const
Generation of a random value in the range .
Definition: Random.h:222
Header file for the complete StaticMatrix implementation.
StaticVector< float, 3UL, false > Vec3f
3-dimensional single precision vector.
Definition: StaticVector.h:222
StaticVector< float, 6UL, false > Vec6f
6-dimensional single precision vector.
Definition: StaticVector.h:246
StaticVector< double, 6UL, false > Vec6d
6-dimensional double precision vector.
Definition: StaticVector.h:254