Blaze  3.6
CustomVector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_CUSTOMVECTOR_H_
36 #define _BLAZE_MATH_CUSTOMVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
46 #include <blaze/math/DenseVector.h>
48 #include <blaze/math/ZeroVector.h>
49 #include <blaze/util/Random.h>
50 
51 
52 namespace blaze {
53 
54 //=================================================================================================
55 //
56 // RAND SPECIALIZATION
57 //
58 //=================================================================================================
59 
60 //*************************************************************************************************
67 template< typename Type // Data type of the vector
68  , bool AF // Alignment flag
69  , bool PF // Padding flag
70  , bool TF // Transpose flag
71  , typename RT > // Result type
72 class Rand< CustomVector<Type,AF,PF,TF,RT> >
73 {
74  public:
75  //**Randomize functions*************************************************************************
78  inline void randomize( CustomVector<Type,AF,PF,TF,RT>& vector ) const;
79 
80  template< typename Arg >
81  inline void randomize( CustomVector<Type,AF,PF,TF,RT>& vector, const Arg& min, const Arg& max ) const;
83  //**********************************************************************************************
84 };
86 //*************************************************************************************************
87 
88 
89 //*************************************************************************************************
96 template< typename Type // Data type of the vector
97  , bool AF // Alignment flag
98  , bool PF // Padding flag
99  , bool TF // Transpose flag
100  , typename RT > // Result type
101 inline void Rand< CustomVector<Type,AF,PF,TF,RT> >::randomize( CustomVector<Type,AF,PF,TF,RT>& vector ) const
102 {
103  using blaze::randomize;
104 
105  const size_t size( vector.size() );
106  for( size_t i=0UL; i<size; ++i ) {
107  randomize( vector[i] );
108  }
109 }
111 //*************************************************************************************************
112 
113 
114 //*************************************************************************************************
123 template< typename Type // Data type of the vector
124  , bool AF // Alignment flag
125  , bool PF // Padding flag
126  , bool TF // Transpose flag
127  , typename RT > // Result type
128 template< typename Arg > // Min/max argument type
129 inline void Rand< CustomVector<Type,AF,PF,TF,RT> >::randomize( CustomVector<Type,AF,PF,TF,RT>& vector,
130  const Arg& min, const Arg& max ) const
131 {
132  using blaze::randomize;
133 
134  const size_t size( vector.size() );
135  for( size_t i=0UL; i<size; ++i ) {
136  randomize( vector[i], min, max );
137  }
138 }
140 //*************************************************************************************************
141 
142 } // namespace blaze
143 
144 #endif
Header file for the implementation of a fixed-size vector.
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:929
Implementation of a random number generator.
Header file for the implementation of an arbitrarily sized vector.
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:292
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
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:1162
Header file for the complete ZeroVector implementation.
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:1198
Header file for the implementation of a customizable vector.
Header file for the complete DynamicMatrix implementation.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Header file for all basic DenseVector functionality.