Pow.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_POW_H_
36 #define _BLAZE_MATH_FUNCTORS_POW_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
45 #include <blaze/math/shims/Pow.h>
46 #include <blaze/math/simd/Pow.h>
49 #include <blaze/system/Inline.h>
52 
53 
54 namespace blaze {
55 
56 //=================================================================================================
57 //
58 // CLASS DEFINITION
59 //
60 //=================================================================================================
61 
62 //*************************************************************************************************
66 template< typename ET > // Type of the exponent
67 struct Pow
68 {
69  public:
70  //**Type definitions****************************************************************************
72  //**********************************************************************************************
73 
74  //**********************************************************************************************
79  explicit inline Pow( ET exp )
80  : exp_ ( exp ) // The scalar exponent
81  , simdExp_( set( exp_ ) ) // The SIMD exponent
82  {}
83  //**********************************************************************************************
84 
85  //**********************************************************************************************
91  template< typename T >
92  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T& a ) const
93  {
94  return pow( a, exp_ );
95  }
96  //**********************************************************************************************
97 
98  //**********************************************************************************************
103  template< typename T >
104  static constexpr bool simdEnabled() { return IsSame<T,ET>::value && HasSIMDPow<T>::value; }
105  //**********************************************************************************************
106 
107  //**********************************************************************************************
113  template< typename T >
114  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
115  {
117  return pow( a, simdExp_ );
118  }
119  //**********************************************************************************************
120 
121  private:
122  //**Member variables****************************************************************************
123  ET exp_;
125  //**********************************************************************************************
126 
127  //**Compile time checks*************************************************************************
131  //**********************************************************************************************
132 };
133 //*************************************************************************************************
134 
135 } // namespace blaze
136 
137 #endif
Constraint on the data type.
Header file for the IsSame and IsStrictlySame type traits.
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.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:140
SIMDET simdExp_
The SIMD exponent.
Definition: Pow.h:124
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:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Availability of a SIMD power operation for the given data type.Depending on the available instruction...
Definition: HasSIMDPow.h:110
Header file for the SIMD power functionality.
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.
ET exp_
The scalar exponent.
Definition: Pow.h:123
Pow(ET exp)
Constructor of the Pow functor.
Definition: Pow.h:79
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
decltype(auto) pow(const DenseMatrix< MT, SO > &dm, ET exp)
Computes the exponential value for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1607
SIMDTrait_< ET > SIMDET
The SIMD exponent type.
Definition: Pow.h:71
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: Pow.h:104
#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
Header file for the HasSIMDPow type trait.
decltype(auto) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the pow() function for the given SIMD vector.
Definition: Pow.h:114
System settings for the inline keywords.