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>
64 #include <blaze/system/Inline.h>
66 
67 
68 namespace blaze {
69 
70 //=================================================================================================
71 //
72 // CLASS DEFINITION
73 //
74 //=================================================================================================
75 
76 //*************************************************************************************************
80 struct Add
81 {
82  //**********************************************************************************************
85  explicit inline Add()
86  {}
87  //**********************************************************************************************
88 
89  //**********************************************************************************************
96  template< typename T1, typename T2 >
97  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T1& a, const T2& b ) const
98  {
99  return a + b;
100  }
101  //**********************************************************************************************
102 
103  //**********************************************************************************************
108  template< typename T1, typename T2 >
109  static constexpr bool simdEnabled() { return HasSIMDAdd_v<T1,T2>; }
110  //**********************************************************************************************
111 
112  //**********************************************************************************************
117  static constexpr bool paddingEnabled() { return true; }
118  //**********************************************************************************************
119 
120  //**********************************************************************************************
127  template< typename T1, typename T2 >
128  BLAZE_ALWAYS_INLINE decltype(auto) load( const T1& a, const T2& b ) const
129  {
132  return a + b;
133  }
134  //**********************************************************************************************
135 };
136 //*************************************************************************************************
137 
138 
139 
140 
141 //=================================================================================================
142 //
143 // YIELDSUNIFORM SPECIALIZATIONS
144 //
145 //=================================================================================================
146 
147 //*************************************************************************************************
149 template< typename T1, typename T2 >
150 struct YieldsUniform<Add,T1,T2>
151  : public BoolConstant< IsUniform_v<T1> && IsUniform_v<T2> >
152 {};
154 //*************************************************************************************************
155 
156 
157 
158 
159 //=================================================================================================
160 //
161 // YIELDSSYMMETRIC SPECIALIZATIONS
162 //
163 //=================================================================================================
164 
165 //*************************************************************************************************
167 template< typename MT1, typename MT2 >
168 struct YieldsSymmetric<Add,MT1,MT2>
169  : public BoolConstant< IsSymmetric_v<MT1> && IsSymmetric_v<MT2> >
170 {};
172 //*************************************************************************************************
173 
174 
175 
176 
177 //=================================================================================================
178 //
179 // YIELDSHERMITIAN SPECIALIZATIONS
180 //
181 //=================================================================================================
182 
183 //*************************************************************************************************
185 template< typename MT1, typename MT2 >
186 struct YieldsHermitian<Add,MT1,MT2>
187  : public BoolConstant< IsHermitian_v<MT1> && IsHermitian_v<MT2> >
188 {};
190 //*************************************************************************************************
191 
192 
193 
194 
195 //=================================================================================================
196 //
197 // YIELDSLOWER SPECIALIZATIONS
198 //
199 //=================================================================================================
200 
201 //*************************************************************************************************
203 template< typename MT1, typename MT2 >
204 struct YieldsLower<Add,MT1,MT2>
205  : public BoolConstant< IsLower_v<MT1> && IsLower_v<MT2> >
206 {};
208 //*************************************************************************************************
209 
210 
211 
212 
213 //=================================================================================================
214 //
215 // YIELDSUNILOWER SPECIALIZATIONS
216 //
217 //=================================================================================================
218 
219 //*************************************************************************************************
221 template< typename MT1, typename MT2 >
222 struct YieldsUniLower<Add,MT1,MT2>
223  : public BoolConstant< ( IsUniLower_v<MT1> && IsStrictlyLower_v<MT2> ) ||
224  ( IsUniLower_v<MT2> && IsStrictlyLower_v<MT1> ) >
225 {};
227 //*************************************************************************************************
228 
229 
230 
231 
232 //=================================================================================================
233 //
234 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
235 //
236 //=================================================================================================
237 
238 //*************************************************************************************************
240 template< typename MT1, typename MT2 >
241 struct YieldsStrictlyLower<Add,MT1,MT2>
242  : public BoolConstant< IsStrictlyLower_v<MT1> && IsStrictlyLower_v<MT2> >
243 {};
245 //*************************************************************************************************
246 
247 
248 
249 
250 //=================================================================================================
251 //
252 // YIELDSUPPER SPECIALIZATIONS
253 //
254 //=================================================================================================
255 
256 //*************************************************************************************************
258 template< typename MT1, typename MT2 >
259 struct YieldsUpper<Add,MT1,MT2>
260  : public BoolConstant< IsUpper_v<MT1> && IsUpper_v<MT2> >
261 {};
263 //*************************************************************************************************
264 
265 
266 
267 
268 //=================================================================================================
269 //
270 // YIELDSUNIUPPER SPECIALIZATIONS
271 //
272 //=================================================================================================
273 
274 //*************************************************************************************************
276 template< typename MT1, typename MT2 >
277 struct YieldsUniUpper<Add,MT1,MT2>
278  : public BoolConstant< ( IsUniUpper_v<MT1> && IsStrictlyUpper_v<MT2> ) ||
279  ( IsUniUpper_v<MT2> && IsStrictlyUpper_v<MT1> ) >
280 {};
282 //*************************************************************************************************
283 
284 
285 
286 
287 //=================================================================================================
288 //
289 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
290 //
291 //=================================================================================================
292 
293 //*************************************************************************************************
295 template< typename MT1, typename MT2 >
296 struct YieldsStrictlyUpper<Add,MT1,MT2>
297  : public BoolConstant< IsStrictlyUpper_v<MT1> && IsStrictlyUpper_v<MT2> >
298 {};
300 //*************************************************************************************************
301 
302 } // namespace blaze
303 
304 #endif
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower 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:128
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types T1 and T2.
Definition: Add.h:109
Generic wrapper for the addition operator.
Definition: Add.h:80
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:117
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 YieldsLower type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
Header file for the IntegralConstant class template.
Add()
Default constructor of the Add functor.
Definition: Add.h:85
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.