43 T inf = std::numeric_limits<T>::max();
44 if (a == inf || b == inf){
53 struct BoolCopy2ndSRing
55 static OUT
id() {
return OUT(); }
57 static OUT
add(
const OUT & arg1,
const OUT & arg2)
59 std::cout <<
"Add should not happen (BoolCopy2ndSRing)!" << std::endl;
60 throw std::string(
"Add should not happen!");
64 static const OUT&
multiply(
bool arg1,
const OUT & arg2)
68 static void axpy(
bool a,
const OUT & x, OUT & y)
76 static bool exists =
false;
81 MPI_Op_create(
MPI_func,
true, &mpiop);
87 static void MPI_func(
void * invec,
void * inoutvec,
int * len, MPI_Datatype *datatype)
91 std::cout <<
"MPI Add should not happen (BoolCopy2ndSRing)!" << std::endl;
99 struct BoolCopy1stSRing
101 static OUT
id() {
return OUT(); }
103 static OUT
add(
const OUT & arg1,
const OUT & arg2)
105 std::cout <<
"Add should not happen (BoolCopy1stSRing)!" << std::endl;
106 throw std::string(
"Add should not happen!");
110 static const OUT&
multiply(
const OUT & arg1,
bool arg2)
114 static void axpy(
const OUT& a,
bool x, OUT & y)
122 static bool exists =
false;
127 MPI_Op_create(
MPI_func,
true, &mpiop);
133 static void MPI_func(
void * invec,
void * inoutvec,
int * len, MPI_Datatype *datatype)
137 std::cout <<
"MPI Add should not happen (BoolCopy1stSRing)!" << std::endl;
145 template <
class T1,
class T2,
class OUT>
146 struct Select2ndSRing
148 static OUT
id() {
return OUT(); }
150 static MPI_Op
mpi_op() {
return MPI_MAX; };
151 static OUT
add(
const OUT & arg1,
const OUT & arg2)
155 static OUT
multiply(
const T1 & arg1,
const T2 & arg2)
158 return static_cast<OUT
>(arg2);
160 static void axpy(T1 a,
const T2 & x, OUT & y)
167 template <
class T1,
class T2>
168 struct SelectMaxSRing
173 static MPI_Op
mpi_op() {
return MPI_MAX; };
176 return std::max(arg1, arg2);
187 y = std::max(y,
static_cast<T_promote>(a*x));
194 struct SelectMaxSRing<bool, T2>
199 static MPI_Op
mpi_op() {
return MPI_MAX; };
202 return std::max(arg1, arg2);
214 template <
class T1,
class T2>
215 struct PlusTimesSRing
220 static MPI_Op
mpi_op() {
return MPI_SUM; };
237 template <
class T1,
class T2>
241 static T_promote id() {
return std::numeric_limits<T_promote>::max(); };
243 static MPI_Op
mpi_op() {
return MPI_MIN; };
246 return std::min(arg1, arg2);
static const OUT & multiply(const OUT &arg1, bool arg2)
static OUT add(const OUT &arg1, const OUT &arg2)
static void axpy(const OUT &a, bool x, OUT &y)
static bool returnedSAID()
static void MPI_func(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
static bool returnedSAID()
static const OUT & multiply(bool arg1, const OUT &arg2)
static void MPI_func(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
static OUT add(const OUT &arg1, const OUT &arg2)
static void axpy(bool a, const OUT &x, OUT &y)
promote_trait< T1, T2 >::T_promote T_promote
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static bool returnedSAID()
static void axpy(T1 a, const T2 &x, T_promote &y)
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static T_promote add(const T_promote &arg1, const T_promote &arg2)
promote_trait< T1, T2 >::T_promote T_promote
static void axpy(T1 a, const T2 &x, T_promote &y)
static bool returnedSAID()
static void axpy(T1 a, const T2 &x, OUT &y)
static bool returnedSAID()
static OUT multiply(const T1 &arg1, const T2 &arg2)
static OUT add(const OUT &arg1, const OUT &arg2)
static bool returnedSAID()
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static void axpy(bool a, const T2 &x, T_promote &y)
static T_promote multiply(const bool &arg1, const T2 &arg2)
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static void axpy(T1 a, const T2 &x, T_promote &y)
static bool returnedSAID()
static T_promote add(const T_promote &arg1, const T_promote &arg2)
promote_trait< T1, T2 >::T_promote T_promote
T operator()(const T &a, const T &b) const