#include <NumericalIntegration.h>
Public Member Functions | |
double | error () const |
GaussIntegrator (double epsilon) | |
GaussIntegrator () | |
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 |
static const double | w [12] |
double | xx |
Static Private Attributes | |
static const double | kCST = 5./1000 |
static const double | kHF = 0.5 |
static const double | x [12] |
Definition at line 63 of file NumericalIntegration.h.
funct::GaussIntegrator::GaussIntegrator | ( | ) | [inline] |
Definition at line 65 of file NumericalIntegration.h.
{ }
funct::GaussIntegrator::GaussIntegrator | ( | double | epsilon | ) | [inline] |
Definition at line 66 of file NumericalIntegration.h.
double funct::GaussIntegrator::error | ( | ) | const [inline] |
double funct::GaussIntegrator::operator() | ( | const F & | f, |
double | a, | ||
double | b | ||
) | const [inline] |
Definition at line 68 of file NumericalIntegration.h.
References a, aa, abs, funct::abs(), aconst, b, bb, c1, c2, epsilon_, error_, f, f1, f2, h, i, kCST, kHF, s16, s8, u, w, x, and xx.
{ h = 0; if (b == a) return h; aconst = kCST/std::abs(b - a); bb = a; CASE1: aa = bb; bb = b; CASE2: c1 = kHF*(bb + aa); c2 = kHF*(bb - aa); s8 = 0; for(i = 0; i < 4; ++i) { u = c2*x[i]; xx = c1 + u; f1 = f(xx); xx = c1-u; f2 = f(xx); s8 += w[i]*(f1 + f2); } s16 = 0; for(i = 4; i < 12; ++i) { u = c2*x[i]; xx = c1+u; f1 = f(xx); xx = c1-u; f2 = f(xx); s16 += w[i]*(f1 + f2); } s16 = c2*s16; if (std::abs(s16 - c2*s8) <= epsilon_*(1. + std::abs(s16))) { h += s16; if(bb != b) goto CASE1; } else { bb = c1; if(1. + aconst*std::abs(c2) != 1) goto CASE2; h = s8; } error_ = std::abs(s16 - c2*s8); return h; }
double funct::GaussIntegrator::aa [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::aconst [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::bb [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::c1 [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::c2 [mutable, private] |
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_ [mutable, private] |
Definition at line 112 of file NumericalIntegration.h.
Referenced by error(), and operator()().
double funct::GaussIntegrator::f1 [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::f2 [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::h [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
unsigned int funct::GaussIntegrator::i [mutable, private] |
Definition at line 118 of file NumericalIntegration.h.
Referenced by operator()().
const double funct::GaussIntegrator::kCST = 5./1000 [static, private] |
Definition at line 116 of file NumericalIntegration.h.
Referenced by operator()().
const double funct::GaussIntegrator::kHF = 0.5 [static, private] |
Definition at line 115 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::s16 [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::s8 [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
double funct::GaussIntegrator::u [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().
const double funct::GaussIntegrator::w [private] |
{ 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 [static, private] |
{ 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 operator()().
double funct::GaussIntegrator::xx [mutable, private] |
Definition at line 117 of file NumericalIntegration.h.
Referenced by operator()().