43 T inf = std::numeric_limits<T>::max();
44 if (a == inf || b == inf){
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;
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>
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>
171 static T_promote
id() {
return -1; };
173 static MPI_Op
mpi_op() {
return MPI_MAX; };
174 static T_promote
add(
const T_promote & arg1,
const T_promote & arg2)
176 return std::max(arg1, arg2);
178 static T_promote
multiply(
const T1 & arg1,
const T2 & arg2)
182 return (static_cast<T_promote>(arg1) *
183 static_cast<T_promote>(arg2) );
185 static void axpy(T1 a,
const T2 & x, T_promote & y)
187 y = std::max(y, static_cast<T_promote>(a*x));
197 static T_promote
id(){
return -1; };
199 static MPI_Op
mpi_op() {
return MPI_MAX; };
200 static T_promote
add(
const T_promote & arg1,
const T_promote & arg2)
202 return std::max(arg1, arg2);
204 static T_promote
multiply(
const bool & arg1,
const T2 & arg2)
208 static void axpy(
bool a,
const T2 & x, T_promote & y)
214 template <
class T1,
class T2>
218 static T_promote
id(){
return 0; }
220 static MPI_Op
mpi_op() {
return MPI_SUM; };
221 static T_promote
add(
const T_promote & arg1,
const T_promote & arg2)
225 static T_promote
multiply(
const T1 & arg1,
const T2 & arg2)
227 return (static_cast<T_promote>(arg1) *
228 static_cast<T_promote>(arg2) );
230 static void axpy(T1 a,
const T2 & x, T_promote & y)
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; };
244 static T_promote
add(
const T_promote & arg1,
const T_promote & arg2)
246 return std::min(arg1, arg2);
248 static T_promote
multiply(
const T1 & arg1,
const T2 & arg2)
251 (
static_cast<T_promote
>(arg1), static_cast<T_promote>(arg2));
253 static void axpy(T1 a,
const T2 & x, T_promote & y)
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)
static bool returnedSAID()
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static bool returnedSAID()
static OUT add(const OUT &arg1, const OUT &arg2)
static bool returnedSAID()
static void axpy(T1 a, const T2 &x, OUT &y)
promote_trait< T1, T2 >::T_promote T_promote
static void axpy(T1 a, const T2 &x, T_promote &y)
static OUT add(const OUT &arg1, const OUT &arg2)
static void MPI_func(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
static void axpy(bool a, const OUT &x, OUT &y)
static OUT multiply(const T1 &arg1, const T2 &arg2)
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static void axpy(bool a, const T2 &x, T_promote &y)
static void axpy(T1 a, const T2 &x, T_promote &y)
static const OUT & multiply(bool arg1, const OUT &arg2)
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static void axpy(const OUT &a, bool x, OUT &y)
static bool returnedSAID()
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static bool returnedSAID()
static void MPI_func(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
promote_trait< T1, T2 >::T_promote T_promote
T operator()(const T &a, const T &b) const
static T_promote multiply(const bool &arg1, const T2 &arg2)
static OUT add(const OUT &arg1, const OUT &arg2)
SpDCCols< IT, NT > * multiply(SpDCCols< IT, NT > &splitA, SpDCCols< IT, NT > &splitB, CCGrid &CMG, bool isBT, bool threaded)
static bool returnedSAID()
promote_trait< T1, T2 >::T_promote T_promote
static bool returnedSAID()
static const OUT & multiply(const OUT &arg1, bool arg2)