CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
funct::GaussIntegrator Class Reference

#include <NumericalIntegration.h>

Public Member Functions

double error () const
 
 GaussIntegrator ()
 
 GaussIntegrator (double epsilon)
 
template<typename F >
double operator() (const F &f, double a, double b) const
 

Private Attributes

double aa
 
double aconst
 
double bb
 
double c1
 
double c2
 
double epsilon_
 
double error_
 
double f1
 
double f2
 
double h
 
unsigned int i
 
double s16
 
double s8
 
double u
 
double xx
 

Static Private Attributes

static const double kCST = 5./1000
 
static const double kHF = 0.5
 
static const double w [12]
 
static const double x [12]
 

Detailed Description

Definition at line 63 of file NumericalIntegration.h.

Constructor & Destructor Documentation

funct::GaussIntegrator::GaussIntegrator ( )
inline

Definition at line 65 of file NumericalIntegration.h.

65 { }
funct::GaussIntegrator::GaussIntegrator ( double  epsilon)
inline

Definition at line 66 of file NumericalIntegration.h.

Member Function Documentation

double funct::GaussIntegrator::error ( ) const
inline
template<typename F >
double funct::GaussIntegrator::operator() ( const F f,
double  a,
double  b 
) const
inline

Definition at line 68 of file NumericalIntegration.h.

References a, aa, funct::abs(), aconst, b, bb, c1, c2, epsilon_, error_, f, f1, f2, h, i, kCST, kHF, s16, s8, u, w, x, and xx.

68  {
69  h = 0;
70  if (b == a) return h;
71  aconst = kCST/std::abs(b - a);
72  bb = a;
73  CASE1:
74  aa = bb;
75  bb = b;
76  CASE2:
77  c1 = kHF*(bb + aa);
78  c2 = kHF*(bb - aa);
79  s8 = 0;
80  for(i = 0; i < 4; ++i) {
81  u = c2*x[i];
82  xx = c1 + u;
83  f1 = f(xx);
84  xx = c1-u;
85  f2 = f(xx);
86  s8 += w[i]*(f1 + f2);
87  }
88  s16 = 0;
89  for(i = 4; i < 12; ++i) {
90  u = c2*x[i];
91  xx = c1+u;
92  f1 = f(xx);
93  xx = c1-u;
94  f2 = f(xx);
95  s16 += w[i]*(f1 + f2);
96  }
97  s16 = c2*s16;
98  if (std::abs(s16 - c2*s8) <= epsilon_*(1. + std::abs(s16))) {
99  h += s16;
100  if(bb != b) goto CASE1;
101  } else {
102  bb = c1;
103  if(1. + aconst*std::abs(c2) != 1) goto CASE2;
104  h = s8;
105  }
106 
107  error_ = std::abs(s16 - c2*s8);
108  return h;
109  }
static const double kCST
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
double b
Definition: hdecay.h:120
static const double w[12]
double a
Definition: hdecay.h:121
static const double x[12]

Member Data Documentation

double funct::GaussIntegrator::aa
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::aconst
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::bb
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::c1
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::c2
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::epsilon_
private

Definition at line 113 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::error_
mutableprivate

Definition at line 112 of file NumericalIntegration.h.

Referenced by error(), and operator()().

double funct::GaussIntegrator::f1
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::f2
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::h
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

unsigned int funct::GaussIntegrator::i
mutableprivate

Definition at line 118 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::kCST = 5./1000
staticprivate

Definition at line 116 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::kHF = 0.5
staticprivate

Definition at line 115 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::s16
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::s8
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::u
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::w
staticprivate
Initial value:
= {
0.10122853629037626, 0.22238103445337447,
0.31370664587788729, 0.36268378337836198,
0.02715245941175409, 0.06225352393864789,
0.09515851168249278, 0.12462897125553387,
0.14959598881657673, 0.16915651939500254,
0.18260341504492359, 0.18945061045506850 }

Definition at line 114 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::x
staticprivate
Initial value:
= {
0.96028985649753623, 0.79666647741362674,
0.52553240991632899, 0.18343464249564980,
0.98940093499164993, 0.94457502307323258,
0.86563120238783174, 0.75540440835500303,
0.61787624440264375, 0.45801677765722739,
0.28160355077925891, 0.09501250983763744 }

Definition at line 114 of file NumericalIntegration.h.

Referenced by svgfig.Curve.Sample::__repr__(), svgfig.Ellipse::__repr__(), Vispa.Gui.WidgetContainer.WidgetContainer::autosize(), Vispa.Gui.VispaWidget.VispaWidget::boundingRect(), operator()(), geometryXMLparser.Alignable::pos(), and Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget().

double funct::GaussIntegrator::xx
mutableprivate

Definition at line 117 of file NumericalIntegration.h.

Referenced by geometryXMLparser.Alignable::covariance(), and operator()().