All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StaticMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_STATICMATRIX_H_
23 #define _BLAZE_MATH_STATICMATRIX_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
31 #include <blaze/math/DenseMatrix.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 matrix
53  , size_t M // Number of rows
54  , size_t N // Number of columns
55  , bool SO > // Storage order
56 class Rand< StaticMatrix<Type,M,N,SO> >
57 {
58  public:
59  //**Generate functions**************************************************************************
62  inline const StaticMatrix<Type,M,N,SO> generate() const;
63 
64  template< typename Arg >
65  inline const StaticMatrix<Type,M,N,SO> generate( const Arg& min, const Arg& max ) const;
67  //**********************************************************************************************
68 
69  //**Randomize functions*************************************************************************
72  inline void randomize( StaticMatrix<Type,M,N,SO>& matrix ) const;
73 
74  template< typename Arg >
75  inline void randomize( StaticMatrix<Type,M,N,SO>& matrix, const Arg& min, const Arg& max ) const;
77  //**********************************************************************************************
78 };
80 //*************************************************************************************************
81 
82 
83 //*************************************************************************************************
89 template< typename Type // Data type of the matrix
90  , size_t M // Number of rows
91  , size_t N // Number of columns
92  , bool SO > // Storage order
93 inline const StaticMatrix<Type,M,N,SO> Rand< StaticMatrix<Type,M,N,SO> >::generate() const
94 {
95  StaticMatrix<Type,M,N,SO> matrix;
96  randomize( matrix );
97  return matrix;
98 }
100 //*************************************************************************************************
101 
102 
103 //*************************************************************************************************
111 template< typename Type // Data type of the matrix
112  , size_t M // Number of rows
113  , size_t N // Number of columns
114  , bool SO > // Storage order
115 template< typename Arg > // Min/max argument type
116 inline const StaticMatrix<Type,M,N,SO>
117  Rand< StaticMatrix<Type,M,N,SO> >::generate( const Arg& min, const Arg& max ) const
118 {
119  StaticMatrix<Type,M,N,SO> matrix;
120  randomize( matrix, min, max );
121  return matrix;
122 }
124 //*************************************************************************************************
125 
126 
127 //*************************************************************************************************
134 template< typename Type // Data type of the matrix
135  , size_t M // Number of rows
136  , size_t N // Number of columns
137  , bool SO > // Storage order
138 inline void Rand< StaticMatrix<Type,M,N,SO> >::randomize( StaticMatrix<Type,M,N,SO>& matrix ) const
139 {
140  using blaze::randomize;
141 
142  for( size_t i=0UL; i<M; ++i ) {
143  for( size_t j=0UL; j<N; ++j ) {
144  randomize( matrix(i,j) );
145  }
146  }
147 }
149 //*************************************************************************************************
150 
151 
152 //*************************************************************************************************
161 template< typename Type // Data type of the matrix
162  , size_t M // Number of rows
163  , size_t N // Number of columns
164  , bool SO > // Storage order
165 template< typename Arg > // Min/max argument type
166 inline void Rand< StaticMatrix<Type,M,N,SO> >::randomize( StaticMatrix<Type,M,N,SO>& matrix,
167  const Arg& min, const Arg& max ) const
168 {
169  using blaze::randomize;
170 
171  for( size_t i=0UL; i<M; ++i ) {
172  for( size_t j=0UL; j<N; ++j ) {
173  randomize( matrix(i,j), min, max );
174  }
175  }
176 }
178 //*************************************************************************************************
179 
180 
181 
182 
183 //=================================================================================================
184 //
185 // TYPE DEFINITIONS
186 //
187 //=================================================================================================
188 
189 //*************************************************************************************************
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
202 //*************************************************************************************************
203 
204 
205 //*************************************************************************************************
210 //*************************************************************************************************
211 
212 
213 //*************************************************************************************************
218 //*************************************************************************************************
219 
220 
221 //*************************************************************************************************
226 //*************************************************************************************************
227 
228 
229 //*************************************************************************************************
234 //*************************************************************************************************
235 
236 
237 //*************************************************************************************************
242 //*************************************************************************************************
243 
244 
245 //*************************************************************************************************
250 //*************************************************************************************************
251 
252 
253 //*************************************************************************************************
258 //*************************************************************************************************
259 
260 
261 //*************************************************************************************************
266 //*************************************************************************************************
267 
268 
269 //*************************************************************************************************
274 //*************************************************************************************************
275 
276 
277 //*************************************************************************************************
282 //*************************************************************************************************
283 
284 
285 //*************************************************************************************************
290 //*************************************************************************************************
291 
292 
293 //*************************************************************************************************
298 //*************************************************************************************************
299 
300 
301 //*************************************************************************************************
306 //*************************************************************************************************
307 
308 } // namespace blaze
309 
310 #endif