Go to the documentation of this file.00001 #ifndef VIENNAMATH_COMPILETIME_BINARY_OP_TAGS_HPP
00002 #define VIENNAMATH_COMPILETIME_BINARY_OP_TAGS_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <string>
00021 #include <vector>
00022 #include <math.h>
00023 #include "viennamath/forwards.h"
00024
00029 namespace viennamath
00030 {
00031
00032
00033
00034
00036 template <typename NumericT>
00037 struct op_plus
00038 {
00039 typedef NumericT numeric_type;
00040
00041
00042
00043
00044 static NumericT apply(NumericT lhs, NumericT rhs) { return lhs + rhs; }
00045
00046 static std::string str() { return "+"; }
00047 };
00048
00049
00050
00051
00052
00054 template <typename NumericT>
00055 struct op_minus
00056 {
00057 typedef NumericT numeric_type;
00058
00059
00060
00061
00062 static NumericT apply(NumericT lhs, NumericT rhs) { return lhs - rhs; }
00063
00064 static std::string str() { return "-"; }
00065 };
00066
00067
00068
00069
00070
00072 template <typename NumericT>
00073 struct op_mult
00074 {
00075 typedef NumericT numeric_type;
00076
00077
00078
00079
00080 static NumericT apply(NumericT lhs, NumericT rhs) { return lhs * rhs; }
00081
00082 static std::string str() { return "*"; }
00083 };
00084
00085
00086
00087
00088
00090 template <typename NumericT>
00091 struct op_div
00092 {
00093 typedef NumericT numeric_type;
00094
00095
00096
00097
00098 static NumericT apply(NumericT lhs, NumericT rhs) { return lhs / rhs; }
00099
00100 static std::string str() { return "/"; }
00101 };
00102
00103
00104
00105
00106 }
00107
00108 #endif