UnaryPow.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_UNARYPOW_H_
36 #define _BLAZE_MATH_FUNCTORS_UNARYPOW_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/shims/Pow.h>
45 #include <blaze/math/simd/Pow.h>
46 #include <blaze/math/simd/Set.h>
59 #include <blaze/system/Inline.h>
61 
62 
63 namespace blaze {
64 
65 //=================================================================================================
66 //
67 // CLASS DEFINITION
68 //
69 //=================================================================================================
70 
71 //*************************************************************************************************
75 template< typename ET > // Type of the exponent
76 struct UnaryPow
77 {
78  public:
79  //**Type definitions****************************************************************************
81  //**********************************************************************************************
82 
83  //**********************************************************************************************
88  explicit inline UnaryPow( ET exp )
89  : exp_ ( exp ) // The scalar exponent
90  , simdExp_( set( exp_ ) ) // The SIMD exponent
91  {}
92  //**********************************************************************************************
93 
94  //**********************************************************************************************
100  template< typename T >
101  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T& a ) const
102  {
103  return pow( a, exp_ );
104  }
105  //**********************************************************************************************
106 
107  //**********************************************************************************************
112  template< typename T >
113  static constexpr bool simdEnabled() { return HasSIMDPow_v<T,ET>; }
114  //**********************************************************************************************
115 
116  //**********************************************************************************************
121  static constexpr bool paddingEnabled() { return false; }
122  //**********************************************************************************************
123 
124  //**********************************************************************************************
130  template< typename T >
131  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
132  {
134  return pow( a, simdExp_ );
135  }
136  //**********************************************************************************************
137 
138  private:
139  //**Member variables****************************************************************************
140  ET exp_;
142  //**********************************************************************************************
143 
144  //**Compile time checks*************************************************************************
148  //**********************************************************************************************
149 };
150 //*************************************************************************************************
151 
152 
153 
154 
155 //=================================================================================================
156 //
157 // YIELDSUNIFORM SPECIALIZATIONS
158 //
159 //=================================================================================================
160 
161 //*************************************************************************************************
163 template< typename ET, typename T >
164 struct YieldsUniform<UnaryPow<ET>,T>
165  : public IsUniform<T>
166 {};
168 //*************************************************************************************************
169 
170 
171 
172 
173 //=================================================================================================
174 //
175 // YIELDSSYMMETRIC SPECIALIZATIONS
176 //
177 //=================================================================================================
178 
179 //*************************************************************************************************
181 template< typename ET, typename MT >
182 struct YieldsSymmetric<UnaryPow<ET>,MT>
183  : public IsSymmetric<MT>
184 {};
186 //*************************************************************************************************
187 
188 
189 
190 
191 //=================================================================================================
192 //
193 // YIELDSHERMITIAN SPECIALIZATIONS
194 //
195 //=================================================================================================
196 
197 //*************************************************************************************************
199 template< typename ET, typename MT >
200 struct YieldsHermitian<UnaryPow<ET>,MT>
201  : public IsHermitian<MT>
202 {};
204 //*************************************************************************************************
205 
206 
207 
208 
209 //=================================================================================================
210 //
211 // YIELDSUNILOWER SPECIALIZATIONS
212 //
213 //=================================================================================================
214 
215 //*************************************************************************************************
217 template< typename ET, typename MT >
218 struct YieldsUniLower<UnaryPow<ET>,MT>
219  : public IsUniLower<MT>
220 {};
222 //*************************************************************************************************
223 
224 
225 
226 
227 //=================================================================================================
228 //
229 // YIELDSUNIUPPER SPECIALIZATIONS
230 //
231 //=================================================================================================
232 
233 //*************************************************************************************************
235 template< typename ET, typename MT >
236 struct YieldsUniUpper<UnaryPow<ET>,MT>
237  : public IsUniUpper<MT>
238 {};
240 //*************************************************************************************************
241 
242 } // namespace blaze
243 
244 #endif
SIMDET simdExp_
The SIMD exponent.
Definition: UnaryPow.h:141
Constraint on the data type.
Compile time check for operations on vectors and matrices.This type trait tests whether or not the gi...
Definition: YieldsUniform.h:67
Header file for the IsUniUpper type trait.
ET exp_
The scalar exponent.
Definition: UnaryPow.h:140
decltype(auto) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the pow() function for the given SIMD vector.
Definition: UnaryPow.h:131
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1243
Compile time check for uniform vectors and matrices.This type trait tests whether or not the given te...
Definition: IsUniform.h:104
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: UnaryPow.h:121
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
Generic wrapper for the pow() function with fixed exponent.
Definition: Forward.h:129
Header file for the pow shim.
Header file for the SIMD trait.
Header file for the IsUniLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.In case the given data type T is not a SIMD pack, a compilation error is ...
Definition: SIMDPack.h:60
Header file for the IsUniform type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the YieldsUniLower type trait.
UnaryPow(ET exp)
Constructor of the UnaryPow functor.
Definition: UnaryPow.h:88
Header file for the SIMD power functionality.
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: UnaryPow.h:113
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1643
Constraint on the data type.
Header file for the SIMD set functionality.
Header file for the YieldsUniform type trait.
SIMDTrait_t< ET > SIMDET
The SIMD exponent type.
Definition: UnaryPow.h:80
Header file for the YieldsSymmetric type trait.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
Header file for the HasSIMDPow type trait.
Header file for the YieldsUniUpper type trait.
Header file for the YieldsHermitian type trait.
Header file for the IsHermitian type trait.
System settings for the inline keywords.