17 #ifndef KOKKOS_REDUCTION_IDENTITY_HPP
18 #define KOKKOS_REDUCTION_IDENTITY_HPP
19 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
20 #define KOKKOS_IMPL_PUBLIC_INCLUDE
21 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY
24 #include <Kokkos_Macros.hpp>
31 struct reduction_identity;
57 struct reduction_identity<char> {
58 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char sum() {
59 return static_cast<char>(0);
61 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char prod() {
62 return static_cast<char>(1);
64 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char max() {
return CHAR_MIN; }
65 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char min() {
return CHAR_MAX; }
66 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char bor() {
67 return static_cast<char>(0x0);
69 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char band() {
70 return ~static_cast<
char>(0x0);
72 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char lor() {
73 return static_cast<char>(0);
75 KOKKOS_FORCEINLINE_FUNCTION constexpr
static char land() {
76 return static_cast<char>(1);
81 struct reduction_identity<signed char> {
82 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char sum() {
83 return static_cast<signed char>(0);
85 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char prod() {
86 return static_cast<signed char>(1);
88 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char max() {
91 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char min() {
94 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char bor() {
95 return static_cast<signed char>(0x0);
97 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char band() {
98 return ~static_cast<
signed char>(0x0);
100 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char lor() {
101 return static_cast<signed char>(0);
103 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char land() {
104 return static_cast<signed char>(1);
109 struct reduction_identity<bool> {
110 KOKKOS_FORCEINLINE_FUNCTION constexpr
static bool lor() {
111 return static_cast<bool>(
false);
113 KOKKOS_FORCEINLINE_FUNCTION constexpr
static bool land() {
114 return static_cast<bool>(
true);
119 struct reduction_identity<short> {
120 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short sum() {
121 return static_cast<short>(0);
123 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short prod() {
124 return static_cast<short>(1);
126 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short max() {
return SHRT_MIN; }
127 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short min() {
return SHRT_MAX; }
128 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short bor() {
129 return static_cast<short>(0x0);
131 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short band() {
132 return ~static_cast<
short>(0x0);
134 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short lor() {
135 return static_cast<short>(0);
137 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short land() {
138 return static_cast<short>(1);
143 struct reduction_identity<int> {
144 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int sum() {
145 return static_cast<int>(0);
147 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int prod() {
148 return static_cast<int>(1);
150 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int max() {
return INT_MIN; }
151 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int min() {
return INT_MAX; }
152 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int bor() {
153 return static_cast<int>(0x0);
155 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int band() {
156 return ~static_cast<
int>(0x0);
158 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int lor() {
159 return static_cast<int>(0);
161 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int land() {
162 return static_cast<int>(1);
167 struct reduction_identity<long> {
168 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long sum() {
169 return static_cast<long>(0);
171 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long prod() {
172 return static_cast<long>(1);
174 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long max() {
return LONG_MIN; }
175 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long min() {
return LONG_MAX; }
176 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long bor() {
177 return static_cast<long>(0x0);
179 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long band() {
180 return ~static_cast<
long>(0x0);
182 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long lor() {
183 return static_cast<long>(0);
185 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long land() {
186 return static_cast<long>(1);
191 struct reduction_identity<long long> {
192 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long sum() {
193 return static_cast<long long>(0);
195 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long prod() {
196 return static_cast<long long>(1);
198 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long max() {
201 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long min() {
204 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long bor() {
205 return static_cast<long long>(0x0);
207 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long band() {
208 return ~static_cast<
long long>(0x0);
210 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long lor() {
211 return static_cast<long long>(0);
213 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long land() {
214 return static_cast<long long>(1);
219 struct reduction_identity<unsigned char> {
220 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char sum() {
221 return static_cast<unsigned char>(0);
223 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char prod() {
224 return static_cast<unsigned char>(1);
226 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char max() {
227 return static_cast<unsigned char>(0);
229 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char min() {
232 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char bor() {
233 return static_cast<unsigned char>(0x0);
235 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char band() {
236 return ~static_cast<
unsigned char>(0x0);
238 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char lor() {
239 return static_cast<unsigned char>(0);
241 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char land() {
242 return static_cast<unsigned char>(1);
247 struct reduction_identity<unsigned short> {
248 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short sum() {
249 return static_cast<unsigned short>(0);
251 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short prod() {
252 return static_cast<unsigned short>(1);
254 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short max() {
255 return static_cast<unsigned short>(0);
257 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short min() {
260 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short bor() {
261 return static_cast<unsigned short>(0x0);
263 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short band() {
264 return ~static_cast<
unsigned short>(0x0);
266 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short lor() {
267 return static_cast<unsigned short>(0);
269 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short land() {
270 return static_cast<unsigned short>(1);
275 struct reduction_identity<unsigned int> {
276 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int sum() {
277 return static_cast<unsigned int>(0);
279 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int prod() {
280 return static_cast<unsigned int>(1);
282 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int max() {
283 return static_cast<unsigned int>(0);
285 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int min() {
288 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int bor() {
289 return static_cast<unsigned int>(0x0);
291 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int band() {
292 return ~static_cast<
unsigned int>(0x0);
294 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int lor() {
295 return static_cast<unsigned int>(0);
297 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int land() {
298 return static_cast<unsigned int>(1);
303 struct reduction_identity<unsigned long> {
304 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long sum() {
305 return static_cast<unsigned long>(0);
307 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long prod() {
308 return static_cast<unsigned long>(1);
310 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long max() {
311 return static_cast<unsigned long>(0);
313 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long min() {
316 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long bor() {
317 return static_cast<unsigned long>(0x0);
319 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long band() {
320 return ~static_cast<
unsigned long>(0x0);
322 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long lor() {
323 return static_cast<unsigned long>(0);
325 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long land() {
326 return static_cast<unsigned long>(1);
331 struct reduction_identity<unsigned long long> {
332 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long sum() {
333 return static_cast<unsigned long long>(0);
335 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long prod() {
336 return static_cast<unsigned long long>(1);
338 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long max() {
339 return static_cast<unsigned long long>(0);
341 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long min() {
344 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long bor() {
345 return static_cast<unsigned long long>(0x0);
347 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long band() {
348 return ~static_cast<
unsigned long long>(0x0);
350 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long lor() {
351 return static_cast<unsigned long long>(0);
353 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long land() {
354 return static_cast<unsigned long long>(1);
359 struct reduction_identity<float> {
360 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float sum() {
361 return static_cast<float>(0.0f);
363 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float prod() {
364 return static_cast<float>(1.0f);
366 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float max() {
return -FLT_MAX; }
367 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float min() {
return FLT_MAX; }
371 struct reduction_identity<double> {
372 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double sum() {
373 return static_cast<double>(0.0);
375 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double prod() {
376 return static_cast<double>(1.0);
378 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double max() {
return -DBL_MAX; }
379 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double min() {
return DBL_MAX; }
385 struct reduction_identity<long double> {
386 constexpr
static long double sum() {
return static_cast<long double>(0.0); }
387 constexpr
static long double prod() {
return static_cast<long double>(1.0); }
388 constexpr
static long double max() {
return -LDBL_MAX; }
389 constexpr
static long double min() {
return LDBL_MAX; }
394 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY
395 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
396 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY