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>
49 #include <blaze/system/Inline.h>
51 
52 
53 namespace blaze {
54 
55 //=================================================================================================
56 //
57 // CLASS DEFINITION
58 //
59 //=================================================================================================
60 
61 //*************************************************************************************************
65 template< typename ET > // Type of the exponent
66 struct UnaryPow
67 {
68  public:
69  //**Type definitions****************************************************************************
71  //**********************************************************************************************
72 
73  //**********************************************************************************************
78  explicit inline UnaryPow( ET exp )
79  : exp_ ( exp ) // The scalar exponent
80  , simdExp_( set( exp_ ) ) // The SIMD exponent
81  {}
82  //**********************************************************************************************
83 
84  //**********************************************************************************************
90  template< typename T >
91  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T& a ) const
92  {
93  return pow( a, exp_ );
94  }
95  //**********************************************************************************************
96 
97  //**********************************************************************************************
102  template< typename T >
103  static constexpr bool simdEnabled() { return HasSIMDPow<T,ET>::value; }
104  //**********************************************************************************************
105 
106  //**********************************************************************************************
112  template< typename T >
113  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
114  {
116  return pow( a, simdExp_ );
117  }
118  //**********************************************************************************************
119 
120  private:
121  //**Member variables****************************************************************************
122  ET exp_;
124  //**********************************************************************************************
125 
126  //**Compile time checks*************************************************************************
130  //**********************************************************************************************
131 };
132 //*************************************************************************************************
133 
134 } // namespace blaze
135 
136 #endif
SIMDET simdExp_
The SIMD exponent.
Definition: UnaryPow.h:123
Constraint on the data type.
ET exp_
The scalar exponent.
Definition: UnaryPow.h:122
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:113
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:1267
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:316
Header file for the pow shim.
Header file for the SIMD 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
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
UnaryPow(ET exp)
Constructor of the UnaryPow functor.
Definition: UnaryPow.h:78
Availability of a SIMD power operation for the given data type.Depending on the available instruction...
Definition: HasSIMDPow.h:112
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:103
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1638
Constraint on the data type.
Header file for the SIMD set functionality.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#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
SIMDTrait_< ET > SIMDET
The SIMD exponent type.
Definition: UnaryPow.h:70
Header file for the HasSIMDPow type trait.
System settings for the inline keywords.