45 #ifndef KOKKOS_NUMERICTRAITS_HPP
46 #define KOKKOS_NUMERICTRAITS_HPP
54 struct reduction_identity;
80 struct reduction_identity<signed char> {
81 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char sum() {
82 return static_cast<signed char>(0);
84 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char prod() {
85 return static_cast<signed char>(1);
87 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char max() {
90 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char min() {
93 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char bor() {
94 return static_cast<signed char>(0x0);
96 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char band() {
97 return ~static_cast<
signed char>(0x0);
99 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char lor() {
100 return static_cast<signed char>(0);
102 KOKKOS_FORCEINLINE_FUNCTION constexpr
static signed char land() {
103 return static_cast<signed char>(1);
108 struct reduction_identity<short> {
109 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short sum() {
110 return static_cast<short>(0);
112 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short prod() {
113 return static_cast<short>(1);
115 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short max() {
return SHRT_MIN; }
116 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short min() {
return SHRT_MAX; }
117 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short bor() {
118 return static_cast<short>(0x0);
120 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short band() {
121 return ~static_cast<
short>(0x0);
123 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short lor() {
124 return static_cast<short>(0);
126 KOKKOS_FORCEINLINE_FUNCTION constexpr
static short land() {
127 return static_cast<short>(1);
132 struct reduction_identity<int> {
133 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int sum() {
134 return static_cast<int>(0);
136 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int prod() {
137 return static_cast<int>(1);
139 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int max() {
return INT_MIN; }
140 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int min() {
return INT_MAX; }
141 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int bor() {
142 return static_cast<int>(0x0);
144 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int band() {
145 return ~static_cast<
int>(0x0);
147 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int lor() {
148 return static_cast<int>(0);
150 KOKKOS_FORCEINLINE_FUNCTION constexpr
static int land() {
151 return static_cast<int>(1);
156 struct reduction_identity<long> {
157 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long sum() {
158 return static_cast<long>(0);
160 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long prod() {
161 return static_cast<long>(1);
163 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long max() {
return LONG_MIN; }
164 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long min() {
return LONG_MAX; }
165 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long bor() {
166 return static_cast<long>(0x0);
168 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long band() {
169 return ~static_cast<
long>(0x0);
171 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long lor() {
172 return static_cast<long>(0);
174 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long land() {
175 return static_cast<long>(1);
180 struct reduction_identity<long long> {
181 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long sum() {
182 return static_cast<long long>(0);
184 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long prod() {
185 return static_cast<long long>(1);
187 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long max() {
190 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long min() {
193 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long bor() {
194 return static_cast<long long>(0x0);
196 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long band() {
197 return ~static_cast<
long long>(0x0);
199 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long lor() {
200 return static_cast<long long>(0);
202 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long long land() {
203 return static_cast<long long>(1);
208 struct reduction_identity<unsigned char> {
209 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char sum() {
210 return static_cast<unsigned char>(0);
212 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char prod() {
213 return static_cast<unsigned char>(1);
215 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char max() {
216 return static_cast<unsigned char>(0);
218 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char min() {
221 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char bor() {
222 return static_cast<unsigned char>(0x0);
224 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char band() {
225 return ~static_cast<
unsigned char>(0x0);
227 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char lor() {
228 return static_cast<unsigned char>(0);
230 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned char land() {
231 return static_cast<unsigned char>(1);
236 struct reduction_identity<unsigned short> {
237 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short sum() {
238 return static_cast<unsigned short>(0);
240 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short prod() {
241 return static_cast<unsigned short>(1);
243 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short max() {
244 return static_cast<unsigned short>(0);
246 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short min() {
249 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short bor() {
250 return static_cast<unsigned short>(0x0);
252 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short band() {
253 return ~static_cast<
unsigned short>(0x0);
255 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short lor() {
256 return static_cast<unsigned short>(0);
258 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned short land() {
259 return static_cast<unsigned short>(1);
264 struct reduction_identity<unsigned int> {
265 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int sum() {
266 return static_cast<unsigned int>(0);
268 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int prod() {
269 return static_cast<unsigned int>(1);
271 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int max() {
272 return static_cast<unsigned int>(0);
274 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int min() {
277 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int bor() {
278 return static_cast<unsigned int>(0x0);
280 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int band() {
281 return ~static_cast<
unsigned int>(0x0);
283 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int lor() {
284 return static_cast<unsigned int>(0);
286 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned int land() {
287 return static_cast<unsigned int>(1);
292 struct reduction_identity<unsigned long> {
293 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long sum() {
294 return static_cast<unsigned long>(0);
296 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long prod() {
297 return static_cast<unsigned long>(1);
299 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long max() {
300 return static_cast<unsigned long>(0);
302 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long min() {
305 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long bor() {
306 return static_cast<unsigned long>(0x0);
308 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long band() {
309 return ~static_cast<
unsigned long>(0x0);
311 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long lor() {
312 return static_cast<unsigned long>(0);
314 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long land() {
315 return static_cast<unsigned long>(1);
320 struct reduction_identity<unsigned long long> {
321 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long sum() {
322 return static_cast<unsigned long long>(0);
324 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long prod() {
325 return static_cast<unsigned long long>(1);
327 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long max() {
328 return static_cast<unsigned long long>(0);
330 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long min() {
333 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long bor() {
334 return static_cast<unsigned long long>(0x0);
336 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long band() {
337 return ~static_cast<
unsigned long long>(0x0);
339 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long lor() {
340 return static_cast<unsigned long long>(0);
342 KOKKOS_FORCEINLINE_FUNCTION constexpr
static unsigned long long land() {
343 return static_cast<unsigned long long>(1);
348 struct reduction_identity<float> {
349 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float sum() {
350 return static_cast<float>(0.0f);
352 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float prod() {
353 return static_cast<float>(1.0f);
355 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float max() {
return -FLT_MAX; }
356 KOKKOS_FORCEINLINE_FUNCTION constexpr
static float min() {
return FLT_MAX; }
360 struct reduction_identity<double> {
361 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double sum() {
362 return static_cast<double>(0.0);
364 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double prod() {
365 return static_cast<double>(1.0);
367 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double max() {
return -DBL_MAX; }
368 KOKKOS_FORCEINLINE_FUNCTION constexpr
static double min() {
return DBL_MAX; }
371 #if !defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) && \
372 !defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HIP_GPU)
374 struct reduction_identity<long double> {
375 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long double sum() {
376 return static_cast<long double>(0.0);
378 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long double prod() {
379 return static_cast<long double>(1.0);
381 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long double max() {
384 KOKKOS_FORCEINLINE_FUNCTION constexpr
static long double min() {