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>
62 #include <blaze/system/Inline.h>
63 
64 
65 namespace blaze {
66 
67 //=================================================================================================
68 //
69 // CLASS DEFINITION
70 //
71 //=================================================================================================
72 
73 //*************************************************************************************************
77 struct Pow2
78 {
79  //**********************************************************************************************
82  explicit inline Pow2()
83  {}
84  //**********************************************************************************************
85 
86  //**********************************************************************************************
92  template< typename T >
93  BLAZE_ALWAYS_INLINE constexpr decltype(auto) operator()( const T& a ) const
94  {
95  return pow2( a );
96  }
97  //**********************************************************************************************
98 
99  //**********************************************************************************************
104  template< typename T >
105  static constexpr bool simdEnabled() { return HasSIMDMult_v<T,T>; }
106  //**********************************************************************************************
107 
108  //**********************************************************************************************
113  static constexpr bool paddingEnabled() { return true; }
114  //**********************************************************************************************
115 
116  //**********************************************************************************************
122  template< typename T >
123  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
124  {
126  return pow2( a );
127  }
128  //**********************************************************************************************
129 };
130 //*************************************************************************************************
131 
132 
133 
134 
135 //=================================================================================================
136 //
137 // YIELDSUNIFORM SPECIALIZATIONS
138 //
139 //=================================================================================================
140 
141 //*************************************************************************************************
143 template< typename T >
144 struct YieldsUniform<Pow2,T>
145  : public IsUniform<T>
146 {};
148 //*************************************************************************************************
149 
150 
151 
152 
153 //=================================================================================================
154 //
155 // YIELDSLOWER SPECIALIZATIONS
156 //
157 //=================================================================================================
158 
159 //*************************************************************************************************
161 template< typename MT >
162 struct YieldsLower<Pow2,MT>
163  : public IsLower<MT>
164 {};
166 //*************************************************************************************************
167 
168 
169 
170 
171 //=================================================================================================
172 //
173 // YIELDSUNILOWER SPECIALIZATIONS
174 //
175 //=================================================================================================
176 
177 //*************************************************************************************************
179 template< typename MT >
180 struct YieldsUniLower<Pow2,MT>
181  : public IsUniLower<MT>
182 {};
184 //*************************************************************************************************
185 
186 
187 
188 
189 //=================================================================================================
190 //
191 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
192 //
193 //=================================================================================================
194 
195 //*************************************************************************************************
197 template< typename MT >
198 struct YieldsStrictlyLower<Pow2,MT>
199  : public IsStrictlyLower<MT>
200 {};
202 //*************************************************************************************************
203 
204 
205 
206 
207 //=================================================================================================
208 //
209 // YIELDSUPPER SPECIALIZATIONS
210 //
211 //=================================================================================================
212 
213 //*************************************************************************************************
215 template< typename MT >
216 struct YieldsUpper<Pow2,MT>
217  : public IsUpper<MT>
218 {};
220 //*************************************************************************************************
221 
222 
223 
224 
225 //=================================================================================================
226 //
227 // YIELDSUNIUPPER SPECIALIZATIONS
228 //
229 //=================================================================================================
230 
231 //*************************************************************************************************
233 template< typename MT >
234 struct YieldsUniUpper<Pow2,MT>
235  : public IsUniUpper<MT>
236 {};
238 //*************************************************************************************************
239 
240 
241 
242 
243 //=================================================================================================
244 //
245 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
246 //
247 //=================================================================================================
248 
249 //*************************************************************************************************
251 template< typename MT >
252 struct YieldsStrictlyUpper<Pow2,MT>
253  : public IsStrictlyUpper<MT>
254 {};
256 //*************************************************************************************************
257 
258 
259 
260 
261 //=================================================================================================
262 //
263 // YIELDSZERO SPECIALIZATIONS
264 //
265 //=================================================================================================
266 
267 //*************************************************************************************************
269 template< typename T >
270 struct YieldsZero<Pow2,T>
271  : public IsZero<T>
272 {};
274 //*************************************************************************************************
275 
276 } // namespace blaze
277 
278 #endif
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Pow2.h:113
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 IsStrictlyUpper 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 YieldsStrictlyUpper type trait.
Header file for the YieldsUniLower type trait.
Header file for the IsLower type trait.
Header file for the pow2 shim.
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: Pow2.h:105
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Generic wrapper for the pow2() function.
Definition: Pow2.h:77
Header file for the HasSIMDMult type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsUpper type trait.
Header file for the IsZero type trait.
decltype(auto) pow2(const Proxy< PT, RT > &proxy)
Computing the square value of the represented element.
Definition: Proxy.h:1384
Header file for the YieldsLower type trait.
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:123
Pow2()
Default constructor of the Pow2 functor.
Definition: Pow2.h:82
Header file for the IsUpper type trait.
Header file for the YieldsUniUpper type trait.
System settings for the inline keywords.