14 namespace componentwise {
21 template <
class T1,
class T2,
int N,
int STYLE,
22 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
25 auto ret = left.template createHostObject<decltype(T1()+T2())>();
26 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] + right; }
29 template <
class T1,
class T2,
int N,
int STYLE>
32 auto ret = left.template createDeviceObject<decltype(T1()+T2())>();
34 c::parallel_for(
"YAKL_internal_array_operator+" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] + right; });
38 template <
class T1,
class T2,
int N,
int STYLE,
39 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
44 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
45 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
48 SArray<decltype(T1()+T2()),N,D0,D1,D2,D3> ret;
49 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] + right; }
52 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
53 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
56 FSArray<decltype(T1()+T2()),N,B0,B1,B2,B3> ret;
57 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] + right; }
62 template <
class T1,
class T2,
int N,
int STYLE,
63 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
66 auto ret = left.template createHostObject<decltype(T1()-T2())>();
67 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] - right; }
70 template <
class T1,
class T2,
int N,
int STYLE>
73 auto ret = left.template createDeviceObject<decltype(T1()-T2())>();
75 c::parallel_for(
"YAKL_internal_array_operator-" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] - right; });
79 template <
class T1,
class T2,
int N,
int STYLE,
80 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
85 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
86 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
89 SArray<decltype(T1()-T2()),N,D0,D1,D2,D3> ret;
90 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] - right; }
93 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
94 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
97 FSArray<decltype(T1()-T2()),N,B0,B1,B2,B3> ret;
98 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] - right; }
103 template <
class T1,
class T2,
int N,
int STYLE,
104 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
107 auto ret = left.template createHostObject<decltype(T1()*T2())>();
108 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] * right; }
111 template <
class T1,
class T2,
int N,
int STYLE>
114 auto ret = left.template createDeviceObject<decltype(T1()*T2())>();
116 c::parallel_for(
"YAKL_internal_array_operator*" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] * right; });
120 template <
class T1,
class T2,
int N,
int STYLE,
121 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
126 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
127 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
130 SArray<decltype(T1()*T2()),N,D0,D1,D2,D3> ret;
131 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] * right; }
134 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
135 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
138 FSArray<decltype(T1()*T2()),N,B0,B1,B2,B3> ret;
139 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] * right; }
144 template <
class T1,
class T2,
int N,
int STYLE,
145 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
148 auto ret = left.template createHostObject<decltype(T1()/T2())>();
149 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] / right; }
152 template <
class T1,
class T2,
int N,
int STYLE>
155 auto ret = left.template createDeviceObject<decltype(T1()/T2())>();
157 c::parallel_for(
"YAKL_internal_array_operator/" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] / right; });
161 template <
class T1,
class T2,
int N,
int STYLE,
162 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
167 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
168 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
171 SArray<decltype(T1()/T2()),N,D0,D1,D2,D3> ret;
172 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] / right; }
175 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
176 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
179 FSArray<decltype(T1()/T2()),N,B0,B1,B2,B3> ret;
180 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] / right; }
185 template <
class T1,
class T2,
int N,
int STYLE,
186 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
189 auto ret = left.template createHostObject<decltype(T1()>T2())>();
190 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] > right; }
193 template <
class T1,
class T2,
int N,
int STYLE>
196 auto ret = left.template createDeviceObject<decltype(T1()>T2())>();
198 c::parallel_for(
"YAKL_internal_array_operator>" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] > right; });
202 template <
class T1,
class T2,
int N,
int STYLE,
203 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
208 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
209 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
212 SArray<decltype(T1()>T2()),N,D0,D1,D2,D3> ret;
213 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] > right; }
216 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
217 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
220 FSArray<decltype(T1()>T2()),N,B0,B1,B2,B3> ret;
221 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] > right; }
226 template <
class T1,
class T2,
int N,
int STYLE,
227 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
230 auto ret = left.template createHostObject<decltype(T1()<T2())>();
231 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] < right; }
234 template <
class T1,
class T2,
int N,
int STYLE>
237 auto ret = left.template createDeviceObject<decltype(T1()<T2())>();
239 c::parallel_for(
"YAKL_internal_array_operator<" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] < right; });
243 template <
class T1,
class T2,
int N,
int STYLE,
244 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
249 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
250 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
253 SArray<decltype(T1()<T2()),N,D0,D1,D2,D3> ret;
254 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] < right; }
257 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
258 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
261 FSArray<decltype(T1()<T2()),N,B0,B1,B2,B3> ret;
262 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] < right; }
267 template <
class T1,
class T2,
int N,
int STYLE,
268 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
271 auto ret = left.template createHostObject<decltype(T1()>=T2())>();
272 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] >= right; }
275 template <
class T1,
class T2,
int N,
int STYLE>
278 auto ret = left.template createDeviceObject<decltype(T1()>=T2())>();
280 c::parallel_for(
"YAKL_internal_array_operator>=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] >= right; });
284 template <
class T1,
class T2,
int N,
int STYLE,
285 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
290 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
291 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
294 SArray<decltype(T1()>=T2()),N,D0,D1,D2,D3> ret;
295 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] >= right; }
298 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
299 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
302 FSArray<decltype(T1()>=T2()),N,B0,B1,B2,B3> ret;
303 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] >= right; }
308 template <
class T1,
class T2,
int N,
int STYLE,
309 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
312 auto ret = left.template createHostObject<decltype(T1()<=T2())>();
313 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] <= right; }
316 template <
class T1,
class T2,
int N,
int STYLE>
319 auto ret = left.template createDeviceObject<decltype(T1()<=T2())>();
321 c::parallel_for(
"YAKL_internal_array_operator<=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] <= right; });
325 template <
class T1,
class T2,
int N,
int STYLE,
326 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
331 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
332 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
335 SArray<decltype(T1()<=T2()),N,D0,D1,D2,D3> ret;
336 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] <= right; }
339 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
340 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
343 FSArray<decltype(T1()<=T2()),N,B0,B1,B2,B3> ret;
344 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] <= right; }
349 template <
class T1,
class T2,
int N,
int STYLE,
350 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
353 auto ret = left.template createHostObject<decltype(T1()==T2())>();
354 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] == right; }
357 template <
class T1,
class T2,
int N,
int STYLE>
360 auto ret = left.template createDeviceObject<decltype(T1()==T2())>();
362 c::parallel_for(
"YAKL_internal_array_operator==" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] == right; });
366 template <
class T1,
class T2,
int N,
int STYLE,
367 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
372 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
373 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
376 SArray<decltype(T1()==T2()),N,D0,D1,D2,D3> ret;
377 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] == right; }
380 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
381 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
384 FSArray<decltype(T1()==T2()),N,B0,B1,B2,B3> ret;
385 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] == right; }
390 template <
class T1,
class T2,
int N,
int STYLE,
391 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
394 auto ret = left.template createHostObject<decltype(T1()!=T2())>();
395 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] != right; }
398 template <
class T1,
class T2,
int N,
int STYLE>
401 auto ret = left.template createDeviceObject<decltype(T1()!=T2())>();
403 c::parallel_for(
"YAKL_internal_array_operator!=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] != right; });
407 template <
class T1,
class T2,
int N,
int STYLE,
408 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
413 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
414 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
417 SArray<decltype(T1()!=T2()),N,D0,D1,D2,D3> ret;
418 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] != right; }
421 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
422 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
425 FSArray<decltype(T1()!=T2()),N,B0,B1,B2,B3> ret;
426 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] != right; }
431 template <
class T1,
class T2,
int N,
int STYLE,
432 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
435 auto ret = left.template createHostObject<decltype(T1()&&T2())>();
436 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] && right; }
439 template <
class T1,
class T2,
int N,
int STYLE>
442 auto ret = left.template createDeviceObject<decltype(T1()&&T2())>();
444 c::parallel_for(
"YAKL_internal_array_operator&&" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] && right; });
448 template <
class T1,
class T2,
int N,
int STYLE,
449 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
454 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
455 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
458 SArray<decltype(T1()&&T2()),N,D0,D1,D2,D3> ret;
459 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] && right; }
462 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
463 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
466 FSArray<decltype(T1()&&T2()),N,B0,B1,B2,B3> ret;
467 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] && right; }
472 template <
class T1,
class T2,
int N,
int STYLE,
473 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
476 auto ret = left.template createHostObject<decltype(T1()||T2())>();
477 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] || right; }
480 template <
class T1,
class T2,
int N,
int STYLE>
483 auto ret = left.template createDeviceObject<decltype(T1()||T2())>();
485 c::parallel_for(
"YAKL_internal_array_operator||" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] || right; });
489 template <
class T1,
class T2,
int N,
int STYLE,
490 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
495 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
496 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
499 SArray<decltype(T1()||T2()),N,D0,D1,D2,D3> ret;
500 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] || right; }
503 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
504 typename std::enable_if<std::is_arithmetic<T2>::value,
bool>::type =
false>
507 FSArray<decltype(T1()||T2()),N,B0,B1,B2,B3> ret;
508 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] || right; }
518 template <
class T1,
class T2,
int N,
int STYLE,
519 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
522 auto ret = right.template createHostObject<decltype(T1()+T2())>();
523 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left + right.data()[i]; }
526 template <
class T1,
class T2,
int N,
int STYLE>
529 auto ret = right.template createDeviceObject<decltype(T1()+T2())>();
531 c::parallel_for(
"YAKL_internal_array_operator+" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left + right.data()[i]; });
535 template <
class T1,
class T2,
int N,
int STYLE,
536 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
541 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
542 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
545 SArray<decltype(T1()+T2()),N,D0,D1,D2,D3> ret;
546 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left + right.
data()[i]; }
549 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
550 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
553 FSArray<decltype(T1()+T2()),N,B0,B1,B2,B3> ret;
554 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left + right.
data()[i]; }
559 template <
class T1,
class T2,
int N,
int STYLE,
560 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
563 auto ret = right.template createHostObject<decltype(T1()-T2())>();
564 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left - right.data()[i]; }
567 template <
class T1,
class T2,
int N,
int STYLE>
570 auto ret = right.template createDeviceObject<decltype(T1()-T2())>();
572 c::parallel_for(
"YAKL_internal_array_operator-" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left - right.data()[i]; });
576 template <
class T1,
class T2,
int N,
int STYLE,
577 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
582 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
583 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
586 SArray<decltype(T1()-T2()),N,D0,D1,D2,D3> ret;
587 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left - right.
data()[i]; }
590 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
591 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
594 FSArray<decltype(T1()-T2()),N,B0,B1,B2,B3> ret;
595 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left - right.
data()[i]; }
600 template <
class T1,
class T2,
int N,
int STYLE,
601 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
604 auto ret = right.template createHostObject<decltype(T1()*T2())>();
605 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left * right.data()[i]; }
608 template <
class T1,
class T2,
int N,
int STYLE>
611 auto ret = right.template createDeviceObject<decltype(T1()*T2())>();
613 c::parallel_for(
"YAKL_internal_array_operator*" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left * right.data()[i]; });
617 template <
class T1,
class T2,
int N,
int STYLE,
618 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
623 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
624 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
627 SArray<decltype(T1()*T2()),N,D0,D1,D2,D3> ret;
628 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left * right.
data()[i]; }
631 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
632 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
635 FSArray<decltype(T1()*T2()),N,B0,B1,B2,B3> ret;
636 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left * right.
data()[i]; }
641 template <
class T1,
class T2,
int N,
int STYLE,
642 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
645 auto ret = right.template createHostObject<decltype(T1()/T2())>();
646 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left / right.data()[i]; }
649 template <
class T1,
class T2,
int N,
int STYLE>
652 auto ret = right.template createDeviceObject<decltype(T1()/T2())>();
654 c::parallel_for(
"YAKL_internal_array_operator/" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left / right.data()[i]; });
658 template <
class T1,
class T2,
int N,
int STYLE,
659 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
664 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
665 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
668 SArray<decltype(T1()/T2()),N,D0,D1,D2,D3> ret;
669 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left / right.
data()[i]; }
672 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
673 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
676 FSArray<decltype(T1()/T2()),N,B0,B1,B2,B3> ret;
677 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left / right.
data()[i]; }
682 template <
class T1,
class T2,
int N,
int STYLE,
683 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
686 auto ret = right.template createHostObject<decltype(T1()>T2())>();
687 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left > right.data()[i]; }
690 template <
class T1,
class T2,
int N,
int STYLE>
693 auto ret = right.template createDeviceObject<decltype(T1()>T2())>();
695 c::parallel_for(
"YAKL_internal_array_operator>" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left > right.data()[i]; });
699 template <
class T1,
class T2,
int N,
int STYLE,
700 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
705 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
706 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
709 SArray<decltype(T1()>T2()),N,D0,D1,D2,D3> ret;
710 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left > right.
data()[i]; }
713 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
714 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
717 FSArray<decltype(T1()>T2()),N,B0,B1,B2,B3> ret;
718 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left > right.
data()[i]; }
723 template <
class T1,
class T2,
int N,
int STYLE,
724 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
727 auto ret = right.template createHostObject<decltype(T1()<T2())>();
728 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left < right.data()[i]; }
731 template <
class T1,
class T2,
int N,
int STYLE>
734 auto ret = right.template createDeviceObject<decltype(T1()<T2())>();
736 c::parallel_for(
"YAKL_internal_array_operator<" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left < right.data()[i]; });
740 template <
class T1,
class T2,
int N,
int STYLE,
741 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
746 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
747 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
750 SArray<decltype(T1()<T2()),N,D0,D1,D2,D3> ret;
751 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left < right.
data()[i]; }
754 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
755 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
758 FSArray<decltype(T1()<T2()),N,B0,B1,B2,B3> ret;
759 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left < right.
data()[i]; }
764 template <
class T1,
class T2,
int N,
int STYLE,
765 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
768 auto ret = right.template createHostObject<decltype(T1()>=T2())>();
769 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left >= right.data()[i]; }
772 template <
class T1,
class T2,
int N,
int STYLE>
775 auto ret = right.template createDeviceObject<decltype(T1()>=T2())>();
777 c::parallel_for(
"YAKL_internal_array_operator>=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left >= right.data()[i]; });
781 template <
class T1,
class T2,
int N,
int STYLE,
782 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
787 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
788 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
791 SArray<decltype(T1()>=T2()),N,D0,D1,D2,D3> ret;
792 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left >= right.
data()[i]; }
795 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
796 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
799 FSArray<decltype(T1()>=T2()),N,B0,B1,B2,B3> ret;
800 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left >= right.
data()[i]; }
805 template <
class T1,
class T2,
int N,
int STYLE,
806 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
809 auto ret = right.template createHostObject<decltype(T1()<=T2())>();
810 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left <= right.data()[i]; }
813 template <
class T1,
class T2,
int N,
int STYLE>
816 auto ret = right.template createDeviceObject<decltype(T1()<=T2())>();
818 c::parallel_for(
"YAKL_internal_array_operator<=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left <= right.data()[i]; });
822 template <
class T1,
class T2,
int N,
int STYLE,
823 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
828 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
829 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
832 SArray<decltype(T1()<=T2()),N,D0,D1,D2,D3> ret;
833 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left <= right.
data()[i]; }
836 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
837 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
840 FSArray<decltype(T1()<=T2()),N,B0,B1,B2,B3> ret;
841 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left <= right.
data()[i]; }
846 template <
class T1,
class T2,
int N,
int STYLE,
847 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
850 auto ret = right.template createHostObject<decltype(T1()==T2())>();
851 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left == right.data()[i]; }
854 template <
class T1,
class T2,
int N,
int STYLE>
857 auto ret = right.template createDeviceObject<decltype(T1()==T2())>();
859 c::parallel_for(
"YAKL_internal_array_operator==" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left == right.data()[i]; });
863 template <
class T1,
class T2,
int N,
int STYLE,
864 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
869 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
870 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
873 SArray<decltype(T1()==T2()),N,D0,D1,D2,D3> ret;
874 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left == right.
data()[i]; }
877 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
878 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
881 FSArray<decltype(T1()==T2()),N,B0,B1,B2,B3> ret;
882 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left == right.
data()[i]; }
887 template <
class T1,
class T2,
int N,
int STYLE,
888 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
891 auto ret = right.template createHostObject<decltype(T1()!=T2())>();
892 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left != right.data()[i]; }
895 template <
class T1,
class T2,
int N,
int STYLE>
898 auto ret = right.template createDeviceObject<decltype(T1()!=T2())>();
900 c::parallel_for(
"YAKL_internal_array_operator!=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left != right.data()[i]; });
904 template <
class T1,
class T2,
int N,
int STYLE,
905 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
910 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
911 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
914 SArray<decltype(T1()!=T2()),N,D0,D1,D2,D3> ret;
915 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left != right.
data()[i]; }
918 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
919 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
922 FSArray<decltype(T1()!=T2()),N,B0,B1,B2,B3> ret;
923 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left != right.
data()[i]; }
928 template <
class T1,
class T2,
int N,
int STYLE,
929 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
932 auto ret = right.template createHostObject<decltype(T1()&&T2())>();
933 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left && right.data()[i]; }
936 template <
class T1,
class T2,
int N,
int STYLE>
939 auto ret = right.template createDeviceObject<decltype(T1()&&T2())>();
941 c::parallel_for(
"YAKL_internal_array_operator&&" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left && right.data()[i]; });
945 template <
class T1,
class T2,
int N,
int STYLE,
946 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
951 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
952 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
955 SArray<decltype(T1()&&T2()),N,D0,D1,D2,D3> ret;
956 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left && right.
data()[i]; }
959 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
960 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
963 FSArray<decltype(T1()&&T2()),N,B0,B1,B2,B3> ret;
964 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left && right.
data()[i]; }
969 template <
class T1,
class T2,
int N,
int STYLE,
970 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
973 auto ret = right.template createHostObject<decltype(T1()||T2())>();
974 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left || right.data()[i]; }
977 template <
class T1,
class T2,
int N,
int STYLE>
980 auto ret = right.template createDeviceObject<decltype(T1()||T2())>();
982 c::parallel_for(
"YAKL_internal_array_operator||" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left || right.data()[i]; });
986 template <
class T1,
class T2,
int N,
int STYLE,
987 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
992 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3,
993 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
996 SArray<decltype(T1()||T2()),N,D0,D1,D2,D3> ret;
997 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left || right.
data()[i]; }
1000 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3,
1001 typename std::enable_if<std::is_arithmetic<T1>::value,
bool>::type =
false>
1004 FSArray<decltype(T1()||T2()),N,B0,B1,B2,B3> ret;
1005 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left || right.
data()[i]; }
1015 template <
class T1,
class T2,
int N,
int STYLE>
1018 auto ret = left.template createHostObject<decltype(T1()+T2())>();
1019 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] + right.data()[i]; }
1022 template <
class T1,
class T2,
int N,
int STYLE>
1025 auto ret = left.template createDeviceObject<decltype(T1()+T2())>();
1027 c::parallel_for(
"YAKL_internal_array_operator+" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] + right.data()[i]; });
1031 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1033 operator+(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1034 SArray<decltype(T1()+T2()),N,D0,D1,D2,D3> ret;
1035 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] + right.
data()[i]; }
1038 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1040 operator+(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1041 FSArray<decltype(T1()+T2()),N,B0,B1,B2,B3> ret;
1042 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] + right.
data()[i]; }
1047 template <
class T1,
class T2,
int N,
int STYLE>
1050 auto ret = left.template createHostObject<decltype(T1()-T2())>();
1051 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] - right.data()[i]; }
1054 template <
class T1,
class T2,
int N,
int STYLE>
1057 auto ret = left.template createDeviceObject<decltype(T1()-T2())>();
1059 c::parallel_for(
"YAKL_internal_array_operator-" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] - right.data()[i]; });
1063 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1065 operator-(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1066 SArray<decltype(T1()-T2()),N,D0,D1,D2,D3> ret;
1067 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] - right.
data()[i]; }
1070 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1072 operator-(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1073 FSArray<decltype(T1()-T2()),N,B0,B1,B2,B3> ret;
1074 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] - right.
data()[i]; }
1079 template <
class T1,
class T2,
int N,
int STYLE>
1082 auto ret = left.template createHostObject<decltype(T1()*T2())>();
1083 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] * right.data()[i]; }
1086 template <
class T1,
class T2,
int N,
int STYLE>
1089 auto ret = left.template createDeviceObject<decltype(T1()*T2())>();
1091 c::parallel_for(
"YAKL_internal_array_operator*" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] * right.data()[i]; });
1095 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1097 operator*(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1098 SArray<decltype(T1()*T2()),N,D0,D1,D2,D3> ret;
1099 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] * right.
data()[i]; }
1102 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1104 operator*(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1105 FSArray<decltype(T1()*T2()),N,B0,B1,B2,B3> ret;
1106 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] * right.
data()[i]; }
1111 template <
class T1,
class T2,
int N,
int STYLE>
1114 auto ret = left.template createHostObject<decltype(T1()/T2())>();
1115 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] / right.data()[i]; }
1118 template <
class T1,
class T2,
int N,
int STYLE>
1121 auto ret = left.template createDeviceObject<decltype(T1()/T2())>();
1123 c::parallel_for(
"YAKL_internal_array_operator/" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] / right.data()[i]; });
1127 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1129 operator/(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1130 SArray<decltype(T1()/T2()),N,D0,D1,D2,D3> ret;
1131 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] / right.
data()[i]; }
1134 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1136 operator/(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1137 FSArray<decltype(T1()/T2()),N,B0,B1,B2,B3> ret;
1138 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] / right.
data()[i]; }
1143 template <
class T1,
class T2,
int N,
int STYLE>
1146 auto ret = left.template createHostObject<decltype(T1()>T2())>();
1147 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] > right.data()[i]; }
1150 template <
class T1,
class T2,
int N,
int STYLE>
1153 auto ret = left.template createDeviceObject<decltype(T1()>T2())>();
1155 c::parallel_for(
"YAKL_internal_array_operator>" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] > right.data()[i]; });
1159 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1161 operator>(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1162 SArray<decltype(T1()>T2()),N,D0,D1,D2,D3> ret;
1163 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] > right.
data()[i]; }
1166 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1168 operator>(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1169 FSArray<decltype(T1()>T2()),N,B0,B1,B2,B3> ret;
1170 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] > right.
data()[i]; }
1175 template <
class T1,
class T2,
int N,
int STYLE>
1178 auto ret = left.template createHostObject<decltype(T1()<T2())>();
1179 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] < right.data()[i]; }
1182 template <
class T1,
class T2,
int N,
int STYLE>
1185 auto ret = left.template createDeviceObject<bool>();
1187 c::parallel_for(
"YAKL_internal_array_operator<" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] < right.data()[i]; });
1191 template <
class T1,
class T2,
int N,
int STYLE>
1196 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1198 operator<(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1199 SArray<decltype(T1()<T2()),N,D0,D1,D2,D3> ret;
1200 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] < right.
data()[i]; }
1203 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1205 operator<(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1206 FSArray<decltype(T1()<T2()),N,B0,B1,B2,B3> ret;
1207 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] < right.
data()[i]; }
1212 template <
class T1,
class T2,
int N,
int STYLE>
1215 auto ret = left.template createHostObject<decltype(T1()>=T2())>();
1216 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] >= right.data()[i]; }
1219 template <
class T1,
class T2,
int N,
int STYLE>
1222 auto ret = left.template createDeviceObject<decltype(T1()>=T2())>();
1224 c::parallel_for(
"YAKL_internal_array_operator>=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] >= right.data()[i]; });
1228 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1230 operator>=(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1231 SArray<decltype(T1()>=T2()),N,D0,D1,D2,D3> ret;
1232 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] >= right.
data()[i]; }
1235 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1237 operator>=(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1238 FSArray<decltype(T1()>=T2()),N,B0,B1,B2,B3> ret;
1239 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] >= right.
data()[i]; }
1244 template <
class T1,
class T2,
int N,
int STYLE>
1247 auto ret = left.template createHostObject<decltype(T1()<=T2())>();
1248 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] <= right.data()[i]; }
1251 template <
class T1,
class T2,
int N,
int STYLE>
1254 auto ret = left.template createDeviceObject<decltype(T1()<=T2())>();
1256 c::parallel_for(
"YAKL_internal_array_operator<=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] <= right.data()[i]; });
1260 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1262 operator<=(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1263 SArray<decltype(T1()<=T2()),N,D0,D1,D2,D3> ret;
1264 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] <= right.
data()[i]; }
1267 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1269 operator<=(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1270 FSArray<decltype(T1()<=T2()),N,B0,B1,B2,B3> ret;
1271 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] <= right.
data()[i]; }
1276 template <
class T1,
class T2,
int N,
int STYLE>
1279 auto ret = left.template createHostObject<decltype(T1()==T2())>();
1280 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] == right.data()[i]; }
1283 template <
class T1,
class T2,
int N,
int STYLE>
1286 auto ret = left.template createDeviceObject<decltype(T1()==T2())>();
1288 c::parallel_for(
"YAKL_internal_array_operator==" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] == right.data()[i]; });
1292 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1294 operator==(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1295 SArray<decltype(T1()==T2()),N,D0,D1,D2,D3> ret;
1296 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] == right.
data()[i]; }
1299 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1301 operator==(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1302 FSArray<decltype(T1()==T2()),N,B0,B1,B2,B3> ret;
1303 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] == right.
data()[i]; }
1308 template <
class T1,
class T2,
int N,
int STYLE>
1311 auto ret = left.template createHostObject<decltype(T1()!=T2())>();
1312 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] != right.data()[i]; }
1315 template <
class T1,
class T2,
int N,
int STYLE>
1318 auto ret = left.template createDeviceObject<decltype(T1()!=T2())>();
1320 c::parallel_for(
"YAKL_internal_array_operator!=" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] != right.data()[i]; });
1324 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1326 operator!=(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1327 SArray<decltype(T1()!=T2()),N,D0,D1,D2,D3> ret;
1328 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] != right.
data()[i]; }
1331 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1333 operator!=(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1334 FSArray<decltype(T1()!=T2()),N,B0,B1,B2,B3> ret;
1335 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] != right.
data()[i]; }
1340 template <
class T1,
class T2,
int N,
int STYLE>
1343 auto ret = left.template createHostObject<decltype(T1()&&T2())>();
1344 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] && right.data()[i]; }
1347 template <
class T1,
class T2,
int N,
int STYLE>
1350 auto ret = left.template createDeviceObject<decltype(T1()&&T2())>();
1352 c::parallel_for(
"YAKL_internal_array_operator&&" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] && right.data()[i]; });
1356 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1358 operator&&(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1359 SArray<decltype(T1()&&T2()),N,D0,D1,D2,D3> ret;
1360 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] && right.
data()[i]; }
1363 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1365 operator&&(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1366 FSArray<decltype(T1()&&T2()),N,B0,B1,B2,B3> ret;
1367 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] && right.
data()[i]; }
1372 template <
class T1,
class T2,
int N,
int STYLE>
1375 auto ret = left.template createHostObject<decltype(T1()||T2())>();
1376 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i] || right.data()[i]; }
1379 template <
class T1,
class T2,
int N,
int STYLE>
1382 auto ret = left.template createDeviceObject<decltype(T1()||T2())>();
1384 c::parallel_for(
"YAKL_internal_array_operator||" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i] || right.data()[i]; });
1388 template <
class T1,
class T2,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1390 operator||(
SArray<T1,N,D0,D1,D2,D3> const &left ,
SArray<T2,N,D0,D1,D2,D3> const &right ) {
1391 SArray<decltype(T1()||T2()),N,D0,D1,D2,D3> ret;
1392 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] || right.
data()[i]; }
1395 template <
class T1,
class T2,
int N,
class B0,
class B1,
class B2,
class B3>
1397 operator||(
FSArray<T1,N,B0,B1,B2,B3> const &left ,
FSArray<T2,N,B0,B1,B2,B3> const &right ) {
1398 FSArray<decltype(T1()||T2()),N,B0,B1,B2,B3> ret;
1399 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i] || right.
data()[i]; }
1408 template <
class T1,
int N,
int STYLE>
1411 auto ret = left.template createHostObject<decltype(!T1())>();
1412 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = ! left.data()[i]; }
1415 template <
class T1,
int N,
int STYLE>
1418 auto ret = left.template createDeviceObject<decltype(!T1())>();
1420 c::parallel_for(
"YAKL_internal_array_operator!" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = ! left.data()[i]; });
1424 template <
class T1,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1427 SArray<decltype(!T1()),N,D0,D1,D2,D3> ret;
1428 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = ! left.
data()[i]; }
1431 template <
class T1,
int N,
class B0,
class B1,
class B2,
class B3>
1434 FSArray<decltype(!T1()),N,B0,B1,B2,B3> ret;
1435 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = ! left.
data()[i]; }
1440 template <
class T1,
int N,
int STYLE>
1443 auto ret = left.template createHostObject<decltype(T1()+1)>();
1444 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i]+1; }
1447 template <
class T1,
int N,
int STYLE>
1450 auto ret = left.template createDeviceObject<decltype(T1()+1)>();
1452 c::parallel_for(
"YAKL_internal_array_operator++" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i]+1; });
1456 template <
class T1,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1459 SArray<decltype(T1()+1),N,D0,D1,D2,D3> ret;
1460 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]+1; }
1463 template <
class T1,
int N,
class B0,
class B1,
class B2,
class B3>
1466 FSArray<decltype(T1()+1),N,B0,B1,B2,B3> ret;
1467 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]+1; }
1472 template <
class T1,
int N,
int STYLE>
1475 auto ret = left.template createHostObject<decltype(T1()+1)>();
1476 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i]+1; }
1479 template <
class T1,
int N,
int STYLE>
1482 auto ret = left.template createDeviceObject<decltype(T1()+1)>();
1484 c::parallel_for(
"YAKL_internal_array_operator++" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i]+1; });
1488 template <
class T1,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1491 SArray<decltype(T1()+1),N,D0,D1,D2,D3> ret;
1492 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]+1; }
1495 template <
class T1,
int N,
class B0,
class B1,
class B2,
class B3>
1498 FSArray<decltype(T1()+1),N,B0,B1,B2,B3> ret;
1499 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]+1; }
1504 template <
class T1,
int N,
int STYLE>
1507 auto ret = left.template createHostObject<decltype(T1()-1)>();
1508 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i]-1; }
1511 template <
class T1,
int N,
int STYLE>
1514 auto ret = left.template createDeviceObject<decltype(T1()-1)>();
1516 c::parallel_for(
"YAKL_internal_array_operator--" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i]-1; });
1520 template <
class T1,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1523 SArray<decltype(T1()-1),N,D0,D1,D2,D3> ret;
1524 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]-1; }
1527 template <
class T1,
int N,
class B0,
class B1,
class B2,
class B3>
1530 FSArray<decltype(T1()-1),N,B0,B1,B2,B3> ret;
1531 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]-1; }
1536 template <
class T1,
int N,
int STYLE>
1539 auto ret = left.template createHostObject<decltype(T1()-1)>();
1540 for (
index_t i=0; i < ret.totElems(); i++) { ret.data()[i] = left.data()[i]-1; }
1543 template <
class T1,
int N,
int STYLE>
1546 auto ret = left.template createDeviceObject<decltype(T1()-1)>();
1548 c::parallel_for(
"YAKL_internal_array_operator--" , ret.totElems() ,
YAKL_LAMBDA (
int i) { ret.data()[i] = left.data()[i]-1; });
1552 template <
class T1,
int N,
unsigned D0,
unsigned D1,
unsigned D2,
unsigned D3>
1555 SArray<decltype(T1()-1),N,D0,D1,D2,D3> ret;
1556 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]-1; }
1559 template <
class T1,
int N,
class B0,
class B1,
class B2,
class B3>
1562 FSArray<decltype(T1()-1),N,B0,B1,B2,B3> ret;
1563 for (
index_t i=0; i < ret.totElems(); i++) { ret.
data()[i] = left.
data()[i]-1; }