Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:31

0001 #ifndef PhysicsTools_Utilities_Simplify_begin_h
0002 #define PhysicsTools_Utilities_Simplify_begin_h
0003 #undef PhysicsTools_Utilities_Simplify_end_h
0004 #define TYP0
0005 
0006 #define TYPT1 typename A
0007 #define TYPT2 typename A, typename B
0008 #define TYPT3 typename A, typename B, typename C
0009 #define TYPT4 typename A, typename B, typename C, typename D
0010 
0011 #define TYPN1 int n
0012 #define TYPN2 int n, int m
0013 #define TYPN3 int n, int m, int k
0014 #define TYPN4 int n, int m, int k, int l
0015 
0016 #define TYPN1T1 int n, typename A
0017 #define TYPN1T2 int n, typename A, typename B
0018 #define TYPN2T1 int n, int m, typename A
0019 #define TYPN2T2 int n, int m, typename A, typename B
0020 #define TYPN3T1 int n, int m, int k, typename A
0021 
0022 #define TYPX typename X
0023 
0024 #define TYPXT1 typename X, typename A
0025 #define TYPXT2 typename X, typename A, typename B
0026 
0027 #define TYPXN1 typename X, int n
0028 #define TYPXN2 typename X, int n, int m
0029 
0030 #define TYPXN1T1 typename X, int n, typename A
0031 #define TYPXN2T1 typename X, int n, int m, typename A
0032 
0033 #define TEMPL(X) template <TYP##X>
0034 
0035 #define NUM(N) Numerical<N>
0036 #define FRACT(N, M) typename Fraction<N, M>::type
0037 #define SUM_S(A, B) SumStruct<A, B>
0038 #define MINUS_S(A) MinusStruct<A>
0039 #define PROD_S(A, B) ProductStruct<A, B>
0040 #define RATIO_S(A, B) RatioStruct<A, B>
0041 #define POWER_S(A, B) PowerStruct<A, B>
0042 #define FRACT_S(N, M) FractionStruct<N, M>
0043 #define SQRT_S(A) SqrtStruct<A>
0044 #define EXP_S(A) ExpStruct<A>
0045 #define LOG_S(A) LogStruct<A>
0046 #define SIN_S(A) SinStruct<A>
0047 #define COS_S(A) CosStruct<A>
0048 #define TAN_S(A) TanStruct<A>
0049 #define ABS_S(A) AbsStruct<A>
0050 #define SGN_S(A) SgnStruct<A>
0051 
0052 #define SUM(A, B) typename Sum<A, B>::type
0053 #define DIFF(A, B) typename Difference<A, B>::type
0054 #define MINUS(A) typename Minus<A>::type
0055 #define PROD(A, B) typename Product<A, B>::type
0056 #define RATIO(A, B) typename Ratio<A, B>::type
0057 #define POWER(A, B) typename Power<A, B>::type
0058 #define SQUARE(A) typename Square<A>::type
0059 #define SQRT(A) typename Sqrt<A>::type
0060 #define EXP(A) typename Exp<A>::type
0061 #define LOG(A) typename Log<A>::type
0062 #define SIN(A) typename Sin<A>::type
0063 #define COS(A) typename Cos<A>::type
0064 #define SIN2(A) typename Sin2<A>::type
0065 #define COS2(A) typename Cos2<A>::type
0066 #define TAN(A) typename Tan<A>::type
0067 #define ABS(A) typename Abs<A>::type
0068 #define SGN(A) typename Sgn<A>::type
0069 
0070 #define COMBINE(A, B, RES)                                             \
0071   inline static type combine(const A& _1, const B& _2) { return RES; } \
0072   struct __useless_ignoreme
0073 
0074 #define MINUS_RULE(TMPL, T, RES, COMB)                      \
0075   template <TMPL>                                           \
0076   struct Minus<T> {                                         \
0077     typedef RES type;                                       \
0078     inline static type operate(const T& _) { return COMB; } \
0079   }
0080 
0081 #define SUM_RULE(TMPL, T1, T2, RES, COMB)                                   \
0082   template <TMPL>                                                           \
0083   struct Sum<T1, T2> {                                                      \
0084     typedef RES type;                                                       \
0085     inline static type combine(const T1& _1, const T2& _2) { return COMB; } \
0086   }
0087 
0088 #define DIFF_RULE(TMPL, T1, T2, RES, COMB)                                  \
0089   template <TMPL>                                                           \
0090   struct Difference<T1, T2> {                                               \
0091     typedef RES type;                                                       \
0092     inline static type combine(const T1& _1, const T2& _2) { return COMB; } \
0093   }
0094 
0095 #define PROD_RULE(TMPL, T1, T2, RES, COMB)                                  \
0096   template <TMPL>                                                           \
0097   struct Product<T1, T2> {                                                  \
0098     typedef RES type;                                                       \
0099     inline static type combine(const T1& _1, const T2& _2) { return COMB; } \
0100   }
0101 
0102 #define RATIO_RULE(TMPL, T1, T2, RES, COMB)                                 \
0103   template <TMPL>                                                           \
0104   struct Ratio<T1, T2> {                                                    \
0105     typedef RES type;                                                       \
0106     inline static type combine(const T1& _1, const T2& _2) { return COMB; } \
0107   }
0108 
0109 #define POWER_RULE(TMPL, T1, T2, RES, COMB)                                 \
0110   template <TMPL>                                                           \
0111   struct Power<T1, T2> {                                                    \
0112     typedef RES type;                                                       \
0113     inline static type combine(const T1& _1, const T2& _2) { return COMB; } \
0114   }
0115 
0116 #define EXP_RULE(TMPL, T, RES, COMB)                        \
0117   template <TMPL>                                           \
0118   struct Exp<T> {                                           \
0119     typedef RES type;                                       \
0120     inline static type compose(const T& _) { return COMB; } \
0121   }
0122 
0123 #define LOG_RULE(TMPL, T, RES, COMB)                        \
0124   template <TMPL>                                           \
0125   struct Log<T> {                                           \
0126     typedef RES type;                                       \
0127     inline static type compose(const T& _) { return COMB; } \
0128   }
0129 
0130 #define SIN_RULE(TMPL, T, RES, COMB)                        \
0131   template <TMPL>                                           \
0132   struct Sin<T> {                                           \
0133     typedef RES type;                                       \
0134     inline static type compose(const T& _) { return COMB; } \
0135   }
0136 
0137 #define COS_RULE(TMPL, T, RES, COMB)                        \
0138   template <TMPL>                                           \
0139   struct Cos<T> {                                           \
0140     typedef RES type;                                       \
0141     inline static type compose(const T& _) { return COMB; } \
0142   }
0143 
0144 #define TAN_RULE(TMPL, T, RES, COMB)                        \
0145   template <TMPL>                                           \
0146   struct Tan<T> {                                           \
0147     typedef RES type;                                       \
0148     inline static type compose(const T& _) { return COMB; } \
0149   }
0150 
0151 #define GET(A, RES)                                  \
0152   inline static type get(const A& _) { return RES; } \
0153                                                      \
0154   struct __useless_ignoreme
0155 
0156 #define DERIV(X, A) typename Derivative<X, A>::type
0157 #define PRIMIT(X, A) typename Primitive<A, X>::type
0158 
0159 #define DERIV_RULE(TMPL, T, RES, COMB)                  \
0160   template <TMPL>                                       \
0161   struct Derivative<X, T> {                             \
0162     typedef RES type;                                   \
0163     inline static type get(const T& _) { return COMB; } \
0164   }
0165 
0166 #define PRIMIT_RULE(TMPL, T, RES, COMB)                 \
0167   template <TMPL>                                       \
0168   struct Primitive<T, X> {                              \
0169     typedef RES type;                                   \
0170     inline static type get(const T& _) { return COMB; } \
0171   }
0172 
0173 #endif