CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SimplifyLogExp.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Utilities_SimplifyLogExp_h
2 #define PhysicsTools_Utilities_SimplifyLogExp_h
3 
10 
12 
13 namespace funct {
14  // log(exp(a)) = a
15  LOG_RULE(TYPT1, EXP_S(A), A, _._);
16 
17  // exp(log(a)) = a
18  EXP_RULE(TYPT1, LOG_S(A), A, _._);
19 
20  // log(a ^ b) = b * log(a)
21  LOG_RULE(TYPT2, POWER_S(A, B), PROD(B, LOG(A)), _._2 * log(_._1));
22 
23  // exp(a) * exp(b) = exp(a + b)
24  PROD_RULE(TYPT2, EXP_S(A), EXP_S(B), EXP(SUM(A, B)), exp(_1._ + _2._));
25 
26  // log(a * b) = log(a) + log (b)
27  LOG_RULE(TYPT2, PROD_S(A, B), SUM(LOG(A), LOG(B)), log(_._1) + log(_._2));
28 
29  // log(a / b) = log(a) - log (b)
30  LOG_RULE(TYPT2, RATIO_S(A, B), DIFF(LOG(A), LOG(B)), log(_._1) - log(_._2));
31 
32  // exp(x) * x = x * exp(x)
33  PROD_RULE(TYPT1, EXP_S(A), A, PROD(A, EXP(A)), _2 * _1 );
34 
35  // log(x) * x = x * log(x)
36  PROD_RULE(TYPT1, LOG_S(A), A, PROD(A, LOG(A)), _2 * _1 );
37 
38 }
39 
41 
42 #endif
#define EXP(A)
#define TYPT2
Definition: Simplify_begin.h:7
PROD_S(A, B)>
Definition: Factorize.h:44
POWER_S(A, NUM(n))>
Definition: Factorize.h:48
#define LOG(A)
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
typedef SUM(SUM(PROD(NUM(n-p), SIN2(A)), PROD(NUM(m-p), COS2(A))), NUM(p)) type
#define RATIO_S(A, B)
PROD_RULE(TYPT2, EXP_S(A), EXP_S(B), EXP(SUM(A, B)), exp(_1._+_2._))
#define LOG_S(A)
EXP_RULE(TYPT1, LOG_S(A), A, _._)
Log< T >::type log(const T &t)
Definition: Log.h:22
#define EXP_S(A)
typedef PROD(F, SUM(RATIO(A, F), RATIO(B, F))) type
typedef DIFF(PROD(A, B1), PRIMIT(X, PROD(A1, B1))) type
LOG_RULE(TYPT1, EXP_S(A), A, _._)
#define TYPT1
Definition: Simplify_begin.h:6