Sqrt.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_SQRT_H_
36 #define _BLAZE_MATH_FUNCTORS_SQRT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/shims/Sqrt.h>
45 #include <blaze/math/simd/Sqrt.h>
67 #include <blaze/system/Inline.h>
68 
69 
70 namespace blaze {
71 
72 //=================================================================================================
73 //
74 // CLASS DEFINITION
75 //
76 //=================================================================================================
77 
78 //*************************************************************************************************
82 struct Sqrt
83 {
84  //**********************************************************************************************
87  explicit inline Sqrt()
88  {}
89  //**********************************************************************************************
90 
91  //**********************************************************************************************
97  template< typename T >
98  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T& a ) const
99  {
100  return sqrt( a );
101  }
102  //**********************************************************************************************
103 
104  //**********************************************************************************************
109  template< typename T >
110  static constexpr bool simdEnabled() { return HasSIMDSqrt_v<T>; }
111  //**********************************************************************************************
112 
113  //**********************************************************************************************
118  static constexpr bool paddingEnabled() { return true; }
119  //**********************************************************************************************
120 
121  //**********************************************************************************************
127  template< typename T >
128  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
129  {
131  return sqrt( a );
132  }
133  //**********************************************************************************************
134 };
135 //*************************************************************************************************
136 
137 
138 
139 
140 //=================================================================================================
141 //
142 // YIELDSUNIFORM SPECIALIZATIONS
143 //
144 //=================================================================================================
145 
146 //*************************************************************************************************
148 template< typename T >
149 struct YieldsUniform<Sqrt,T>
150  : public IsUniform<T>
151 {};
153 //*************************************************************************************************
154 
155 
156 
157 
158 //=================================================================================================
159 //
160 // YIELDSSYMMETRIC SPECIALIZATIONS
161 //
162 //=================================================================================================
163 
164 //*************************************************************************************************
166 template< typename MT >
167 struct YieldsSymmetric<Sqrt,MT>
168  : public IsSymmetric<MT>
169 {};
171 //*************************************************************************************************
172 
173 
174 
175 
176 //=================================================================================================
177 //
178 // YIELDSHERMITIAN SPECIALIZATIONS
179 //
180 //=================================================================================================
181 
182 //*************************************************************************************************
184 template< typename MT >
185 struct YieldsHermitian<Sqrt,MT>
186  : public IsHermitian<MT>
187 {};
189 //*************************************************************************************************
190 
191 
192 
193 
194 //=================================================================================================
195 //
196 // YIELDSLOWER SPECIALIZATIONS
197 //
198 //=================================================================================================
199 
200 //*************************************************************************************************
202 template< typename MT >
203 struct YieldsLower<Sqrt,MT>
204  : public IsLower<MT>
205 {};
207 //*************************************************************************************************
208 
209 
210 
211 
212 //=================================================================================================
213 //
214 // YIELDSUNILOWER SPECIALIZATIONS
215 //
216 //=================================================================================================
217 
218 //*************************************************************************************************
220 template< typename MT >
221 struct YieldsUniLower<Sqrt,MT>
222  : public IsUniLower<MT>
223 {};
225 //*************************************************************************************************
226 
227 
228 
229 
230 //=================================================================================================
231 //
232 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
233 //
234 //=================================================================================================
235 
236 //*************************************************************************************************
238 template< typename MT >
239 struct YieldsStrictlyLower<Sqrt,MT>
240  : public IsStrictlyLower<MT>
241 {};
243 //*************************************************************************************************
244 
245 
246 
247 
248 //=================================================================================================
249 //
250 // YIELDSUPPER SPECIALIZATIONS
251 //
252 //=================================================================================================
253 
254 //*************************************************************************************************
256 template< typename MT >
257 struct YieldsUpper<Sqrt,MT>
258  : public IsUpper<MT>
259 {};
261 //*************************************************************************************************
262 
263 
264 
265 
266 //=================================================================================================
267 //
268 // YIELDSUNIUPPER SPECIALIZATIONS
269 //
270 //=================================================================================================
271 
272 //*************************************************************************************************
274 template< typename MT >
275 struct YieldsUniUpper<Sqrt,MT>
276  : public IsUniUpper<MT>
277 {};
279 //*************************************************************************************************
280 
281 
282 
283 
284 //=================================================================================================
285 //
286 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
287 //
288 //=================================================================================================
289 
290 //*************************************************************************************************
292 template< typename MT >
293 struct YieldsStrictlyUpper<Sqrt,MT>
294  : public IsStrictlyUpper<MT>
295 {};
297 //*************************************************************************************************
298 
299 
300 
301 
302 //=================================================================================================
303 //
304 // YIELDSZERO SPECIALIZATIONS
305 //
306 //=================================================================================================
307 
308 //*************************************************************************************************
310 template< typename T >
311 struct YieldsZero<Sqrt,T>
312  : public IsZero<T>
313 {};
315 //*************************************************************************************************
316 
317 } // namespace blaze
318 
319 #endif
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
Header file for the SIMD square root functionality.
Header file for the IsUniLower type trait.
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Sqrt.h:118
#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 sqrt shim.
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:82
Header file for the IsUniform type trait.
Header file for the IsStrictlyUpper 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 YieldsStrictlyUpper type trait.
Header file for the YieldsUniLower type trait.
Header file for the IsLower type trait.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUpper type trait.
Header file for the IsZero type trait.
Header file for the HasSIMDSqrt type trait.
Header file for the YieldsLower type trait.
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1453
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: Sqrt.h:110
Header file for the IsUpper type trait.
Header file for the YieldsUniUpper type trait.
Sqrt()
Default constructor of the Sqrt functor.
Definition: Sqrt.h:87
Header file for the YieldsHermitian type trait.
Header file for the IsHermitian type trait.
decltype(auto) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the sqrt() function for the given SIMD vector.
Definition: Sqrt.h:128
System settings for the inline keywords.