math.h
00001 #ifndef gridripper_math_h
00002 #define gridripper_math_h
00003
00004 #include "config.h"
00005 #include <cmath>
00006 #include <complex>
00007 #include <cfloat>
00008
00009 namespace gridripper {
00010
00012 const GReal_t GNaN = NAN;
00013 const GReal_t GE = 2.7182818284590452353602874713526625L;
00014 const GReal_t GLog2E = 1.4426950408889634073599246810018921L;
00015 const GReal_t GLlog10E = 0.4342944819032518276511289189166051L;
00016 const GReal_t GLn2 = 0.6931471805599453094172321214581766L;
00017 const GReal_t GLn10 = 2.3025850929940456840179914546843642L;
00018 const GReal_t GPi = 3.1415926535897932384626433832795029L;
00019 const GReal_t GSqrtPi = 1.7724538509055160272981674833411452L;
00020 const GReal_t GPi_2 = 1.5707963267948966192313216916397514L;
00021 const GReal_t GPi_4 = 0.7853981633974483096156608458198757L;
00022 const GReal_t G1_Pi = 0.3183098861837906715377675267450287L;
00023 const GReal_t G2_Pi = 0.6366197723675813430755350534900574L;
00024 const GReal_t G2_SqrtPi = 1.1283791670955125738961589031215452L;
00025 const GReal_t GSqrt2 = 1.4142135623730950488016887242096981L;
00026 const GReal_t GSqrt1_2 = 0.7071067811865475244008443621048490L;
00027 const GReal_t G2Pi = 6.2831853071795864769252867665590058L;
00028 const GReal_t G1_2Pi = 0.1591549430918953357688837633725144L;
00029 const GReal_t GSqrt2Pi = 2.5066282746310005024157652848110452L;
00030 const GReal_t G1_Sqrt2Pi = 0.3989422804014326779399460599343819L;
00031 const GReal_t G4Pi = 12.5663706143591729538505735331180116L;
00032 const GReal_t G1_4Pi = 0.0795774715459476678844418816862572L;
00033 const GReal_t GSqrt4Pi = 3.5449077018110320545963349666822903L;
00034 const GReal_t G1_Sqrt4Pi = 0.2820947917738781434740397257803863L;
00035
00037 const GReal_t GReal_EPSILON = sizeof(GReal_t) == 4? FLT_EPSILON :
00038 sizeof(GReal_t) == 8? DBL_EPSILON :
00039 LDBL_EPSILON;
00040
00041 typedef std::complex<GReal_t> GComplex_t;
00042 const GComplex_t GI(0.0, 1.0);
00043
00045 inline GReal_t square(GReal_t x) {
00046 return x*x;
00047 }
00048
00050 inline GComplex_t square(GComplex_t x) {
00051 return x*x;
00052 }
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 }
00073
00074 #endif