Pow2.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_POW2_H_
36 #define _BLAZE_MATH_FUNCTORS_POW2_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/shims/Pow2.h>
46 #include <blaze/system/Inline.h>
47 
48 
49 namespace blaze {
50 
51 //=================================================================================================
52 //
53 // CLASS DEFINITION
54 //
55 //=================================================================================================
56 
57 //*************************************************************************************************
61 struct Pow2
62 {
63  //**********************************************************************************************
66  explicit inline Pow2()
67  {}
68  //**********************************************************************************************
69 
70  //**********************************************************************************************
76  template< typename T >
77  BLAZE_ALWAYS_INLINE constexpr decltype(auto) operator()( const T& a ) const
78  {
79  return pow2( a );
80  }
81  //**********************************************************************************************
82 
83  //**********************************************************************************************
88  template< typename T >
89  static constexpr bool simdEnabled() { return HasSIMDMult<T,T>::value; }
90  //**********************************************************************************************
91 
92  //**********************************************************************************************
98  template< typename T >
99  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
100  {
102  return pow2( a );
103  }
104  //**********************************************************************************************
105 };
106 //*************************************************************************************************
107 
108 } // namespace blaze
109 
110 #endif
Availability of a SIMD multiplication for the given data types.Depending on the available instruction...
Definition: HasSIMDMult.h:172
#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
Header file for the pow2 shim.
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: Pow2.h:89
Constraint on the data type.
Generic wrapper for the pow2() function.
Definition: Pow2.h:61
Header file for the HasSIMDMult type trait.
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr pow2(const T &a) noexcept(noexcept(a *a))
Squaring the given value/object.
Definition: Pow2.h:65
decltype(auto) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the pow2() function for the given SIMD vector.
Definition: Pow2.h:99
Pow2()
Default constructor of the Pow2 functor.
Definition: Pow2.h:66
System settings for the inline keywords.