Blaze 3.9
UniformMatrix.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_UNIFORMMATRIX_H_
36#define _BLAZE_MATH_UNIFORMMATRIX_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
45#include <blaze/util/Random.h>
46#include <blaze/util/Types.h>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// RAND SPECIALIZATION
54//
55//=================================================================================================
56
57//*************************************************************************************************
64template< typename Type // Data type of the matrix
65 , bool SO // Storage order
66 , typename Tag > // Type tag
67class Rand< UniformMatrix<Type,SO,Tag> >
68{
69 public:
70 //**********************************************************************************************
77 inline const UniformMatrix<Type,SO,Tag> generate( size_t m, size_t n ) const
78 {
79 UniformMatrix<Type,SO,Tag> matrix( m, n );
80 randomize( matrix );
81 return matrix;
82 }
83 //**********************************************************************************************
84
85 //**********************************************************************************************
94 template< typename Arg > // Min/max argument type
95 inline const UniformMatrix<Type,SO,Tag>
96 generate( size_t m, size_t n, const Arg& min, const Arg& max ) const
97 {
98 UniformMatrix<Type,SO,Tag> matrix( m, n );
99 randomize( matrix, min, max );
100 return matrix;
101 }
102 //**********************************************************************************************
103
104 //**********************************************************************************************
110 inline void randomize( UniformMatrix<Type,SO,Tag>& matrix ) const
111 {
112 matrix = rand<Type>();
113 }
114 //**********************************************************************************************
115
116 //**********************************************************************************************
124 template< typename Arg > // Min/max argument type
125 inline void randomize( UniformMatrix<Type,SO,Tag>& matrix,
126 const Arg& min, const Arg& max ) const
127 {
128 matrix = rand<Type>( min, max );
129 }
130 //**********************************************************************************************
131};
133//*************************************************************************************************
134
135} // namespace blaze
136
137#endif
Header file for all basic DenseMatrix functionality.
Header file for the implementation of a uniform matrix.
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
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
Implementation of a random number generator.
Header file for basic type definitions.