Blaze 3.9
Abs.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_FUNCTORS_ABS_H_
36#define _BLAZE_MATH_FUNCTORS_ABS_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
46#include <blaze/math/simd/Abs.h>
68#include <blaze/system/Inline.h>
70
71
72namespace blaze {
73
74//=================================================================================================
75//
76// CLASS DEFINITION
77//
78//=================================================================================================
79
80//*************************************************************************************************
84struct Abs
85{
86 //**********************************************************************************************
92 template< typename T >
93 BLAZE_ALWAYS_INLINE BLAZE_DEVICE_CALLABLE decltype(auto) operator()( T&& a ) const
94 {
95 return abs( std::forward<T>( a ) );
96 }
97 //**********************************************************************************************
98
99 //**********************************************************************************************
104 template< typename T >
105 static constexpr bool simdEnabled() { return HasSIMDAbs_v<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 abs( a );
127 }
128 //**********************************************************************************************
129};
130//*************************************************************************************************
131
132
133
134
135//=================================================================================================
136//
137// YIELDSUNIFORM SPECIALIZATIONS
138//
139//=================================================================================================
140
141//*************************************************************************************************
143template< typename T >
144struct YieldsUniform<Abs,T>
145 : public IsUniform<T>
146{};
148//*************************************************************************************************
149
150
151
152
153//=================================================================================================
154//
155// YIELDSSYMMETRIC SPECIALIZATIONS
156//
157//=================================================================================================
158
159//*************************************************************************************************
161template< typename MT >
162struct YieldsSymmetric<Abs,MT>
163 : public BoolConstant< IsSymmetric_v<MT> || IsHermitian_v<MT> >
164{};
166//*************************************************************************************************
167
168
169
170
171//=================================================================================================
172//
173// YIELDSLOWER SPECIALIZATIONS
174//
175//=================================================================================================
176
177//*************************************************************************************************
179template< typename MT >
180struct YieldsLower<Abs,MT>
181 : public IsLower<MT>
182{};
184//*************************************************************************************************
185
186
187
188
189//=================================================================================================
190//
191// YIELDSUNILOWER SPECIALIZATIONS
192//
193//=================================================================================================
194
195//*************************************************************************************************
197template< typename MT >
198struct YieldsUniLower<Abs,MT>
199 : public IsUniLower<MT>
200{};
202//*************************************************************************************************
203
204
205
206
207//=================================================================================================
208//
209// YIELDSSTRICTLYLOWER SPECIALIZATIONS
210//
211//=================================================================================================
212
213//*************************************************************************************************
215template< typename MT >
216struct YieldsStrictlyLower<Abs,MT>
217 : public IsStrictlyLower<MT>
218{};
220//*************************************************************************************************
221
222
223
224
225//=================================================================================================
226//
227// YIELDSUPPER SPECIALIZATIONS
228//
229//=================================================================================================
230
231//*************************************************************************************************
233template< typename MT >
234struct YieldsUpper<Abs,MT>
235 : public IsUpper<MT>
236{};
238//*************************************************************************************************
239
240
241
242
243//=================================================================================================
244//
245// YIELDSUNIUPPER SPECIALIZATIONS
246//
247//=================================================================================================
248
249//*************************************************************************************************
251template< typename MT >
252struct YieldsUniUpper<Abs,MT>
253 : public IsUniUpper<MT>
254{};
256//*************************************************************************************************
257
258
259
260
261//=================================================================================================
262//
263// YIELDSSTRICTLYUPPER SPECIALIZATIONS
264//
265//=================================================================================================
266
267//*************************************************************************************************
269template< typename MT >
270struct YieldsStrictlyUpper<Abs,MT>
271 : public IsStrictlyUpper<MT>
272{};
274//*************************************************************************************************
275
276
277
278
279//=================================================================================================
280//
281// YIELDSZERO SPECIALIZATIONS
282//
283//=================================================================================================
284
285//*************************************************************************************************
287template< typename T >
288struct YieldsZero<Abs,T>
289 : public IsZero<T>
290{};
292//*************************************************************************************************
293
294} // namespace blaze
295
296#endif
Header file for the HasSIMDAbs type trait.
Macro for CUDA compatibility.
Header file for the IntegralConstant class template.
Header file for the IsHermitian type trait.
Header file for the IsLower type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUniform type trait.
Header file for the IsUpper type trait.
Header file for the YieldsLower type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsStrictlyUpper type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUniLower type trait.
Header file for the YieldsUniUpper type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsUpper type trait.
Header file for the YieldsZero type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.
Definition: SIMDPack.h:60
BLAZE_ALWAYS_INLINE const SIMDdouble abs(const SIMDf64< T > &a) noexcept=delete
Absolute of a vector of double precision floating point values.
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
Header file for the abs shim.
Header file for the SIMD abs functionality.
Generic wrapper for the abs() function.
Definition: Abs.h:85
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: Abs.h:105
BLAZE_ALWAYS_INLINE decltype(auto) load(const T &a) const
Returns the result of the abs() function for the given SIMD vector.
Definition: Abs.h:123
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Abs.h:113
System settings for the inline keywords.
Header file for the IsZero type trait.