StaticMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_STATICMATRIX_H_
36 #define _BLAZE_MATH_STATICMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/DenseMatrix.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 matrix
67  , size_t M // Number of rows
68  , size_t N // Number of columns
69  , bool SO > // Storage order
70 class Rand< StaticMatrix<Type,M,N,SO> >
71 {
72  public:
73  //**Generate functions**************************************************************************
76  inline const StaticMatrix<Type,M,N,SO> generate() const;
77 
78  template< typename Arg >
79  inline const StaticMatrix<Type,M,N,SO> generate( const Arg& min, const Arg& max ) const;
81  //**********************************************************************************************
82 
83  //**Randomize functions*************************************************************************
86  inline void randomize( StaticMatrix<Type,M,N,SO>& matrix ) const;
87 
88  template< typename Arg >
89  inline void randomize( StaticMatrix<Type,M,N,SO>& matrix, const Arg& min, const Arg& max ) const;
91  //**********************************************************************************************
92 };
94 //*************************************************************************************************
95 
96 
97 //*************************************************************************************************
103 template< typename Type // Data type of the matrix
104  , size_t M // Number of rows
105  , size_t N // Number of columns
106  , bool SO > // Storage order
107 inline const StaticMatrix<Type,M,N,SO> Rand< StaticMatrix<Type,M,N,SO> >::generate() const
108 {
109  StaticMatrix<Type,M,N,SO> matrix;
110  randomize( matrix );
111  return matrix;
112 }
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
125 template< typename Type // Data type of the matrix
126  , size_t M // Number of rows
127  , size_t N // Number of columns
128  , bool SO > // Storage order
129 template< typename Arg > // Min/max argument type
130 inline const StaticMatrix<Type,M,N,SO>
131  Rand< StaticMatrix<Type,M,N,SO> >::generate( const Arg& min, const Arg& max ) const
132 {
133  StaticMatrix<Type,M,N,SO> matrix;
134  randomize( matrix, min, max );
135  return matrix;
136 }
138 //*************************************************************************************************
139 
140 
141 //*************************************************************************************************
148 template< typename Type // Data type of the matrix
149  , size_t M // Number of rows
150  , size_t N // Number of columns
151  , bool SO > // Storage order
152 inline void Rand< StaticMatrix<Type,M,N,SO> >::randomize( StaticMatrix<Type,M,N,SO>& matrix ) const
153 {
154  using blaze::randomize;
155 
156  for( size_t i=0UL; i<M; ++i ) {
157  for( size_t j=0UL; j<N; ++j ) {
158  randomize( matrix(i,j) );
159  }
160  }
161 }
163 //*************************************************************************************************
164 
165 
166 //*************************************************************************************************
175 template< typename Type // Data type of the matrix
176  , size_t M // Number of rows
177  , size_t N // Number of columns
178  , bool SO > // Storage order
179 template< typename Arg > // Min/max argument type
180 inline void Rand< StaticMatrix<Type,M,N,SO> >::randomize( StaticMatrix<Type,M,N,SO>& matrix,
181  const Arg& min, const Arg& max ) const
182 {
183  using blaze::randomize;
184 
185  for( size_t i=0UL; i<M; ++i ) {
186  for( size_t j=0UL; j<N; ++j ) {
187  randomize( matrix(i,j), min, max );
188  }
189  }
190 }
192 //*************************************************************************************************
193 
194 
195 
196 
197 //=================================================================================================
198 //
199 // TYPE DEFINITIONS
200 //
201 //=================================================================================================
202 
203 //*************************************************************************************************
208 //*************************************************************************************************
209 
210 
211 //*************************************************************************************************
216 //*************************************************************************************************
217 
218 
219 //*************************************************************************************************
224 //*************************************************************************************************
225 
226 
227 //*************************************************************************************************
232 //*************************************************************************************************
233 
234 
235 //*************************************************************************************************
240 //*************************************************************************************************
241 
242 
243 //*************************************************************************************************
248 //*************************************************************************************************
249 
250 
251 //*************************************************************************************************
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
264 //*************************************************************************************************
265 
266 
267 //*************************************************************************************************
272 //*************************************************************************************************
273 
274 
275 //*************************************************************************************************
280 //*************************************************************************************************
281 
282 
283 //*************************************************************************************************
288 //*************************************************************************************************
289 
290 
291 //*************************************************************************************************
296 //*************************************************************************************************
297 
298 
299 //*************************************************************************************************
304 //*************************************************************************************************
305 
306 
307 //*************************************************************************************************
312 //*************************************************************************************************
313 
314 
315 //*************************************************************************************************
320 //*************************************************************************************************
321 
322 } // namespace blaze
323 
324 #endif
Header file for the complete HybridMatrix implementation.
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1649
StaticMatrix< real, 5UL, 5UL, false > Mat5x5
5x5 matrix with system-specific precision.
Definition: StaticMatrix.h:295
StaticMatrix< real, 2UL, 2UL, false > Mat2x2
2x2 matrix with system-specific precision.
Definition: StaticMatrix.h:223
StaticMatrix< double, 6UL, 6UL, false > Mat6x6d
6x6 double precision matrix.
Definition: StaticMatrix.h:311
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:1043
StaticMatrix< real, 3UL, 3UL, false > Mat3x3
3x3 matrix with system-specific precision.
Definition: StaticMatrix.h:247
Implementation of a random number generator.
StaticMatrix< double, 3UL, 3UL, false > Mat3x3d
3x3 double precision matrix.
Definition: StaticMatrix.h:239
StaticMatrix< double, 5UL, 5UL, false > Mat5x5d
5x5 double precision matrix.
Definition: StaticMatrix.h:287
StaticMatrix< float, 5UL, 5UL, false > Mat5x5f
5x5 single precision matrix.
Definition: StaticMatrix.h:279
Header file for the floating point precision of the Blaze library.
StaticMatrix< float, 2UL, 2UL, false > Mat2x2f
2x2 single precision matrix.
Definition: StaticMatrix.h:207
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:262
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1602
StaticMatrix< real, 4UL, 4UL, false > Mat4x4
4x4 matrix with system-specific precision.
Definition: StaticMatrix.h:271
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:58
Header file for the implementation of a fixed-size matrix.
StaticMatrix< float, 3UL, 3UL, false > Mat3x3f
3x3 single precision matrix.
Definition: StaticMatrix.h:231
Header file for the complete StaticVector implementation.
StaticMatrix< float, 4UL, 4UL, false > Mat4x4f
4x4 single precision matrix.
Definition: StaticMatrix.h:255
T generate() const
Generation of a random value in the range .
Definition: Random.h:222
Header file for all basic DenseMatrix functionality.
StaticMatrix< double, 2UL, 2UL, false > Mat2x2d
2x2 double precision matrix.
Definition: StaticMatrix.h:215
StaticMatrix< double, 4UL, 4UL, false > Mat4x4d
4x4 double precision matrix.
Definition: StaticMatrix.h:263
StaticMatrix< real, 6UL, 6UL, false > Mat6x6
6x6 matrix with system-specific precision.
Definition: StaticMatrix.h:319
StaticMatrix< float, 6UL, 6UL, false > Mat6x6f
6x6 single precision matrix.
Definition: StaticMatrix.h:303