13 T inf = std::numeric_limits<T>::max();
14 if (a == inf || b == inf){
25 static OUT
id() {
return OUT(); }
27 static OUT
add(
const OUT & arg1,
const OUT & arg2)
29 cout <<
"Add should not happen (BoolCopy2ndSRing)!" << endl;
30 throw std::string(
"Add should not happen!");
34 static const OUT&
multiply(
bool arg1,
const OUT & arg2)
38 static void axpy(
bool a,
const OUT & x, OUT & y)
46 static bool exists =
false;
51 MPI_Op_create(
MPI_func,
true, &mpiop);
57 static void MPI_func(
void * invec,
void * inoutvec,
int * len, MPI_Datatype *datatype)
61 cout <<
"MPI Add should not happen (BoolCopy2ndSRing)!" << endl;
71 static OUT
id() {
return OUT(); }
73 static OUT
add(
const OUT & arg1,
const OUT & arg2)
75 cout <<
"Add should not happen (BoolCopy1stSRing)!" << endl;
76 throw std::string(
"Add should not happen!");
80 static const OUT&
multiply(
const OUT & arg1,
bool arg2)
84 static void axpy(
const OUT& a,
bool x, OUT & y)
92 static bool exists =
false;
97 MPI_Op_create(
MPI_func,
true, &mpiop);
103 static void MPI_func(
void * invec,
void * inoutvec,
int * len, MPI_Datatype *datatype)
107 cout <<
"MPI Add should not happen (BoolCopy1stSRing)!" << endl;
115 template <
class T1,
class T2,
class OUT>
118 static OUT
id() {
return OUT(); }
120 static MPI_Op
mpi_op() {
return MPI_MAX; };
121 static OUT
add(
const OUT & arg1,
const OUT & arg2)
125 static OUT
multiply(
const T1 & arg1,
const T2 & arg2)
128 return static_cast<OUT
>(arg2);
130 static void axpy(T1 a,
const T2 & x, OUT & y)
137 template <
class T1,
class T2>
143 static MPI_Op
mpi_op() {
return MPI_MAX; };
146 return std::max(arg1, arg2);
152 return (static_cast<T_promote>(arg1) *
153 static_cast<T_promote>(arg2) );
157 y = std::max(y, static_cast<T_promote>(a*x));
169 static MPI_Op
mpi_op() {
return MPI_MAX; };
172 return std::max(arg1, arg2);
184 template <
class T1,
class T2>
190 static MPI_Op
mpi_op() {
return MPI_SUM; };
197 return (static_cast<T_promote>(arg1) *
198 static_cast<T_promote>(arg2) );
207 template <
class T1,
class T2>
211 static T_promote id() {
return std::numeric_limits<T_promote>::max(); };
213 static MPI_Op
mpi_op() {
return MPI_MIN; };
216 return std::min(arg1, arg2);
221 (
static_cast<T_promote>(arg1), static_cast<T_promote>(arg2));