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/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  , bool AF // Alignment flag
68  , bool PF // Padding flag
69  , bool TF > // Transpose flag
70 class Rand< CustomVector<Type,AF,PF,TF> >
71 {
72  public:
73  //**Randomize functions*************************************************************************
76  inline void randomize( CustomVector<Type,AF,PF,TF>& vector ) const;
77 
78  template< typename Arg >
79  inline void randomize( CustomVector<Type,AF,PF,TF>& vector, const Arg& min, const Arg& max ) const;
81  //**********************************************************************************************
82 };
84 //*************************************************************************************************
85 
86 
87 //*************************************************************************************************
94 template< typename Type // Data type of the vector
95  , bool AF // Alignment flag
96  , bool PF // Padding flag
97  , bool TF > // Transpose flag
98 inline void Rand< CustomVector<Type,AF,PF,TF> >::randomize( CustomVector<Type,AF,PF,TF>& vector ) const
99 {
100  using blaze::randomize;
101 
102  const size_t size( vector.size() );
103  for( size_t i=0UL; i<size; ++i ) {
104  randomize( vector[i] );
105  }
106 }
108 //*************************************************************************************************
109 
110 
111 //*************************************************************************************************
120 template< typename Type // Data type of the vector
121  , bool AF // Alignment flag
122  , bool PF // Padding flag
123  , bool TF > // Transpose flag
124 template< typename Arg > // Min/max argument type
125 inline void Rand< CustomVector<Type,AF,PF,TF> >::randomize( CustomVector<Type,AF,PF,TF>& vector,
126  const Arg& min, const Arg& max ) const
127 {
128  using blaze::randomize;
129 
130  const size_t size( vector.size() );
131  for( size_t i=0UL; i<size; ++i ) {
132  randomize( vector[i], min, max );
133  }
134 }
136 //*************************************************************************************************
137 
138 } // namespace blaze
139 
140 #endif
Header file for the implementation of a fixed-size vector.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:926
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Implementation of a random number generator.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
Header file for the implementation of an arbitrarily sized vector.
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:289
Header file for the implementation of a customizable vector.
Header file for the complete DynamicMatrix implementation.
Header file for all basic DenseVector functionality.