Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef PhysicsTools_Utilities_SimplifyLogExp_h
0002 #define PhysicsTools_Utilities_SimplifyLogExp_h
0003 
0004 #include "PhysicsTools/Utilities/interface/Log.h"
0005 #include "PhysicsTools/Utilities/interface/Exp.h"
0006 #include "PhysicsTools/Utilities/interface/Power.h"
0007 #include "PhysicsTools/Utilities/interface/Product.h"
0008 #include "PhysicsTools/Utilities/interface/Sum.h"
0009 #include "PhysicsTools/Utilities/interface/Difference.h"
0010 #include "PhysicsTools/Utilities/interface/Ratio.h"
0011 
0012 #include "PhysicsTools/Utilities/interface/Simplify_begin.h"
0013 
0014 namespace funct {
0015   // log(exp(a)) = a
0016   LOG_RULE(TYPT1, EXP_S(A), A, _._);
0017 
0018   // exp(log(a)) = a
0019   EXP_RULE(TYPT1, LOG_S(A), A, _._);
0020 
0021   // log(a ^ b) = b * log(a)
0022   LOG_RULE(TYPT2, POWER_S(A, B), PROD(B, LOG(A)), _._2* log(_._1));
0023 
0024   // exp(a) * exp(b) = exp(a + b)
0025   PROD_RULE(TYPT2, EXP_S(A), EXP_S(B), EXP(SUM(A, B)), exp(_1._ + _2._));
0026 
0027   // log(a * b) = log(a) + log (b)
0028   LOG_RULE(TYPT2, PROD_S(A, B), SUM(LOG(A), LOG(B)), log(_._1) + log(_._2));
0029 
0030   // log(a / b) = log(a) - log (b)
0031   LOG_RULE(TYPT2, RATIO_S(A, B), DIFF(LOG(A), LOG(B)), log(_._1) - log(_._2));
0032 
0033   // exp(x) * x = x * exp(x)
0034   PROD_RULE(TYPT1, EXP_S(A), A, PROD(A, EXP(A)), _2* _1);
0035 
0036   // log(x) * x = x * log(x)
0037   PROD_RULE(TYPT1, LOG_S(A), A, PROD(A, LOG(A)), _2* _1);
0038 
0039 }  // namespace funct
0040 
0041 #include "PhysicsTools/Utilities/interface/Simplify_end.h"
0042 
0043 #endif