Blaze  3.6
Add.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_ADD_H_
36 #define _BLAZE_MATH_FUNCTORS_ADD_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/simd/Add.h>
67 #include <blaze/system/Inline.h>
69 
70 
71 namespace blaze {
72 
73 //=================================================================================================
74 //
75 // CLASS DEFINITION
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
83 struct Add
84 {
85  //**********************************************************************************************
92  template< typename T1, typename T2 >
93  BLAZE_ALWAYS_INLINE BLAZE_DEVICE_CALLABLE decltype(auto) operator()( const T1& a, const T2& b ) const
94  {
95  return a + b;
96  }
97  //**********************************************************************************************
98 
99  //**********************************************************************************************
104  template< typename T1, typename T2 >
105  static constexpr bool simdEnabled() { return HasSIMDAdd_v<T1,T2>; }
106  //**********************************************************************************************
107 
108  //**********************************************************************************************
113  static constexpr bool paddingEnabled() { return true; }
114  //**********************************************************************************************
115 
116  //**********************************************************************************************
123  template< typename T1, typename T2 >
124  BLAZE_ALWAYS_INLINE decltype(auto) load( const T1& a, const T2& b ) const
125  {
128  return a + b;
129  }
130  //**********************************************************************************************
131 };
132 //*************************************************************************************************
133 
134 
135 
136 
137 //=================================================================================================
138 //
139 // YIELDSUNIFORM SPECIALIZATIONS
140 //
141 //=================================================================================================
142 
143 //*************************************************************************************************
145 template< typename T1, typename T2 >
146 struct YieldsUniform<Add,T1,T2>
147  : public BoolConstant< IsUniform_v<T1> && IsUniform_v<T2> >
148 {};
150 //*************************************************************************************************
151 
152 
153 
154 
155 //=================================================================================================
156 //
157 // YIELDSSYMMETRIC SPECIALIZATIONS
158 //
159 //=================================================================================================
160 
161 //*************************************************************************************************
163 template< typename MT1, typename MT2 >
164 struct YieldsSymmetric<Add,MT1,MT2>
165  : public BoolConstant< IsSymmetric_v<MT1> && IsSymmetric_v<MT2> >
166 {};
168 //*************************************************************************************************
169 
170 
171 
172 
173 //=================================================================================================
174 //
175 // YIELDSHERMITIAN SPECIALIZATIONS
176 //
177 //=================================================================================================
178 
179 //*************************************************************************************************
181 template< typename MT1, typename MT2 >
182 struct YieldsHermitian<Add,MT1,MT2>
183  : public BoolConstant< IsHermitian_v<MT1> && IsHermitian_v<MT2> >
184 {};
186 //*************************************************************************************************
187 
188 
189 
190 
191 //=================================================================================================
192 //
193 // YIELDSLOWER SPECIALIZATIONS
194 //
195 //=================================================================================================
196 
197 //*************************************************************************************************
199 template< typename MT1, typename MT2 >
200 struct YieldsLower<Add,MT1,MT2>
201  : public BoolConstant< IsLower_v<MT1> && IsLower_v<MT2> >
202 {};
204 //*************************************************************************************************
205 
206 
207 
208 
209 //=================================================================================================
210 //
211 // YIELDSUNILOWER SPECIALIZATIONS
212 //
213 //=================================================================================================
214 
215 //*************************************************************************************************
217 template< typename MT1, typename MT2 >
218 struct YieldsUniLower<Add,MT1,MT2>
219  : public BoolConstant< ( IsUniLower_v<MT1> && IsStrictlyLower_v<MT2> ) ||
220  ( IsUniLower_v<MT2> && IsStrictlyLower_v<MT1> ) >
221 {};
223 //*************************************************************************************************
224 
225 
226 
227 
228 //=================================================================================================
229 //
230 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
231 //
232 //=================================================================================================
233 
234 //*************************************************************************************************
236 template< typename MT1, typename MT2 >
237 struct YieldsStrictlyLower<Add,MT1,MT2>
238  : public BoolConstant< IsStrictlyLower_v<MT1> && IsStrictlyLower_v<MT2> >
239 {};
241 //*************************************************************************************************
242 
243 
244 
245 
246 //=================================================================================================
247 //
248 // YIELDSUPPER SPECIALIZATIONS
249 //
250 //=================================================================================================
251 
252 //*************************************************************************************************
254 template< typename MT1, typename MT2 >
255 struct YieldsUpper<Add,MT1,MT2>
256  : public BoolConstant< IsUpper_v<MT1> && IsUpper_v<MT2> >
257 {};
259 //*************************************************************************************************
260 
261 
262 
263 
264 //=================================================================================================
265 //
266 // YIELDSUNIUPPER SPECIALIZATIONS
267 //
268 //=================================================================================================
269 
270 //*************************************************************************************************
272 template< typename MT1, typename MT2 >
273 struct YieldsUniUpper<Add,MT1,MT2>
274  : public BoolConstant< ( IsUniUpper_v<MT1> && IsStrictlyUpper_v<MT2> ) ||
275  ( IsUniUpper_v<MT2> && IsStrictlyUpper_v<MT1> ) >
276 {};
278 //*************************************************************************************************
279 
280 
281 
282 
283 //=================================================================================================
284 //
285 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
286 //
287 //=================================================================================================
288 
289 //*************************************************************************************************
291 template< typename MT1, typename MT2 >
292 struct YieldsStrictlyUpper<Add,MT1,MT2>
293  : public BoolConstant< IsStrictlyUpper_v<MT1> && IsStrictlyUpper_v<MT2> >
294 {};
296 //*************************************************************************************************
297 
298 
299 
300 
301 //=================================================================================================
302 //
303 // YIELDSZERO SPECIALIZATIONS
304 //
305 //=================================================================================================
306 
307 //*************************************************************************************************
309 template< typename T1, typename T2 >
310 struct YieldsZero<Add,T1,T2>
311  : public BoolConstant< IsZero_v<T1> && IsZero_v<T2> >
312 {};
314 //*************************************************************************************************
315 
316 } // namespace blaze
317 
318 #endif
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
decltype(auto) BLAZE_ALWAYS_INLINE load(const T1 &a, const T2 &b) const
Returns the result of the addition operation for the given SIMD vectors.
Definition: Add.h:124
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types T1 and T2.
Definition: Add.h:105
Generic wrapper for the addition operator.
Definition: Add.h:83
Header file for the IsUniLower type trait.
Header file for the SIMD addition functionality.
#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
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Add.h:113
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 HasSIMDAdd 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 YieldsLower type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
Macro for CUDA compatibility.
Header file for the IntegralConstant class template.
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
Header file for the IsUpper type trait.
Header file for the YieldsUniUpper type trait.
Header file for the YieldsHermitian type trait.
Header file for the IsHermitian type trait.
System settings for the inline keywords.