4#include "CLHEP/GenericFunctions/AbsFunction.hh"
5#include "CLHEP/GenericFunctions/DefiniteIntegral.hh"
38 unsigned int j)
const=0;
62 unsigned int j)
const;
72 mutable double retVal;
73 mutable unsigned int nFunctionCalls;
91 unsigned int j)
const;
101 mutable double retVal;
102 mutable unsigned int nFunctionCalls;
114 void polint(std::vector<double>::iterator xArray, std::vector<double>::iterator yArray,
double x,
double & y,
double & deltay)
const;
168 for (
unsigned int j=1;j<=c->
MAXITER;j++) {
172 double ss(0.), dss(0.);
173 c->
polint(h.begin()+j-c->
K,s.begin()+j-c->
K,0.0,ss, dss);
174 if (fabs(dss) <= c->
EPS*fabs(ss)) {
180 h[j+1]=h[j]/xMult/xMult;
183 throw std::runtime_error(
"DefiniteIntegral: too many steps. No convergence");
188 double dif = fabs(x-xArray[1]),dift;
189 std::vector<double> cc(
K+1),d(
K+1);
191 for (
unsigned int i=1;i<=
K;i++) {
192 dift=fabs(x-xArray[i]);
197 cc[i]=d[i]=yArray[i];
200 for (
unsigned int m=1;m<
K;m++) {
201 for (
unsigned int i=1;i<=
K-m;i++) {
202 double ho = xArray[i]-x;
203 double hp= xArray[i+m]-x;
204 double w=cc[i+1]-d[i];
208 <<
"Error in polynomial extrapolation"
214 deltay = 2*ns < (
K-m) ? cc[ns+1]: d[ns--];
227 retVal = 0.5*(bb-aa)*(function(aa)+function(bb));
231 for (it=1,j=1;j<n-1;j++) it <<=1;
233 double del = (bb-aa)/tnm;
236 for (sum=0.0,j=1;j<=it;j++,x+=del) {
240 retVal = 0.5*(retVal+(bb-aa)*sum/tnm);
249 retVal = (bb-aa)*(function((aa+bb)/2.0));
253 for (it=1,j=1;j<n-1;j++) it *=3;
255 double del = (bb-aa)/(3.0*tnm);
256 double ddel = del+del;
259 for (j=1;j<=it;j++) {
266 retVal = (retVal+(bb-aa)*sum/tnm)/3.0;
virtual unsigned int stepMultiplier() const =0
virtual unsigned int numFunctionCalls() const =0
virtual double integrate(const AbsFunction &function, double a, double b, unsigned int j) const =0
virtual ~QuadratureRule()
virtual unsigned int stepMultiplier() const
virtual unsigned int numFunctionCalls() const
virtual double integrate(const AbsFunction &function, double a, double b, unsigned int j) const
~TrapezoidQuadratureRule()
TrapezoidQuadratureRule()
virtual double integrate(const AbsFunction &function, double a, double b, unsigned int j) const
~XtMidpointQuadratureRule()
virtual unsigned int numFunctionCalls() const
virtual unsigned int stepMultiplier() const
XtMidpointQuadratureRule()
void polint(std::vector< double >::iterator xArray, std::vector< double >::iterator yArray, double x, double &y, double &deltay) const
unsigned int nFunctionCalls
DefiniteIntegral::Type type
DefiniteIntegral(double a, double b, Type=CLOSED)
void setMinOrder(unsigned int order)
virtual double operator[](const AbsFunction &function) const
unsigned int numFunctionCalls() const
DefiniteIntegral & operator=(const DefiniteIntegral &)
void setEpsilon(double eps)
void setMaxIter(unsigned int maxIter)