#ifndef ROOT_Math_IntegratorMultiDim
#define ROOT_Math_IntegratorMultiDim
#ifndef ROOT_Math_IFunctionfwd
#include "Math/IFunctionfwd.h"
#endif
#ifndef ROOT_Math_IntegrationTypes
#include "Math/AllIntegrationTypes.h"
#endif
#ifndef ROOT_Math_VirtualIntegrator
#include "Math/VirtualIntegrator.h"
#endif
#ifndef __CINT__
#ifndef ROOT_Math_WrappedFunction
#include "Math/WrappedFunction.h"
#endif
#endif
namespace ROOT {
namespace Math {
class IntegratorMultiDim {
public:
explicit
IntegratorMultiDim(IntegrationMultiDim::Type type = IntegrationMultiDim::kADAPTIVE, double absTol = 1.E-9, double relTol = 1E-6, unsigned int ncall = 100000) {
fIntegrator = CreateIntegrator(type, absTol, relTol, ncall);
}
explicit
IntegratorMultiDim(const IMultiGenFunction &f, IntegrationMultiDim::Type type = IntegrationMultiDim::kADAPTIVE, double absTol = 1.E-9, double relTol = 1E-6, unsigned int ncall = 100000) {
fIntegrator = CreateIntegrator(type, absTol, relTol, ncall);
SetFunction(f);
}
#ifdef LATER
template<class Function>
IntegratorMultiDim(Function &f, unsigned int dim, IntegrationMultiDim::Type type = IntegrationMultiDim::kADAPTIVE, double absTol = 1.E-9, double relTol = 1E-6, unsigned int ncall = 100000) {
fIntegrator = CreateIntegrator(type, absTol, relTol, ncall);
SetFunction(f, dim);
}
#endif
virtual ~IntegratorMultiDim() {
if (fIntegrator) delete fIntegrator;
}
private:
IntegratorMultiDim(const IntegratorMultiDim &) {}
IntegratorMultiDim & operator=(const IntegratorMultiDim &) { return *this; }
public:
double Integral(const double* xmin, const double * xmax) {
return fIntegrator == 0 ? 0 : fIntegrator->Integral(xmin,xmax);
}
double Integral(const IMultiGenFunction &f, const double* xmin, const double * xmax) {
SetFunction(f);
return Integral(xmin,xmax);
}
template<class Function>
double Integral(Function f, unsigned int dim, const double* xmin, const double * xmax) {
SetFunction(f,dim);
return Integral(xmin, xmax);
}
template <class Function>
void SetFunction(Function f, unsigned int dim) {
ROOT::Math::WrappedMultiFunction<Function> wf(f, dim);
SetFunction(wf);
}
void SetFunction(const IMultiGenFunction &f) {
if (fIntegrator) fIntegrator->SetFunction(f);
}
double Result() const { return fIntegrator == 0 ? 0 : fIntegrator->Result(); }
double Error() const { return fIntegrator == 0 ? 0 : fIntegrator->Error(); }
int Status() const { return fIntegrator == 0 ? -1 : fIntegrator->Status(); }
void SetRelTolerance(double relTol) { if (fIntegrator) fIntegrator->SetRelTolerance(relTol); }
void SetAbsTolerance(double absTol) { if (fIntegrator) fIntegrator->SetAbsTolerance(absTol); }
VirtualIntegratorMultiDim * GetIntegrator() { return fIntegrator; }
protected:
VirtualIntegratorMultiDim * CreateIntegrator(IntegrationMultiDim::Type type , double absTol, double relTol, unsigned int ncall);
private:
VirtualIntegratorMultiDim * fIntegrator;
};
}
}
#endif /* ROOT_Math_IntegratorMultiDim */
Last change: Wed Jun 25 08:29:41 2008
Last generated: 2008-06-25 08:29
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.