16#include "RConfigure.h"
30namespace IntegOneDim {
47namespace IntegMultiDim {
63namespace IntegOptionsUtil {
67 template<
class OptionType>
69 static int N() {
return 0; }
70 static int N(
const OptionType & ) {
return 0; }
76 static int N() {
return OptType::DefaultNPoints(); }
83 static int N() {
return OptType::DefaultNCalls(); }
90 template <
class OptionType>
91 void Print(std::ostream & os,
const OptionType & opt) {
93 os << std::setw(25) <<
"Integrator Type" <<
" : " << std::setw(15) << opt.Integrator() << std::endl;
94 os << std::setw(25) <<
"Absolute tolerance" <<
" : " << std::setw(15) << opt.AbsTolerance() << std::endl;
95 os << std::setw(25) <<
"Relative tolerance" <<
" : " << std::setw(15) << opt.RelTolerance() << std::endl;
96 os << std::setw(25) <<
"Workspace size" <<
" : " << std::setw(15) << opt.WKSize() << std::endl;
98 os << std::setw(25) << OPT::DescriptionOfN() <<
" : " << std::setw(15) << OPT::N(opt) << std::endl;
99 if (opt.ExtraOptions()) {
100 os << opt.Integrator() <<
" specific options :" << std::endl;
101 opt.ExtraOptions()->Print(os);
107 template <
class OptionType>
110 std::string integName = (
name != 0) ?
name : OptionType::DefaultIntegrator();
111 os <<
"Default options for numerical integrator " << integName <<
" : " << std::endl;
112 os << std::setw(25) <<
"Absolute tolerance" <<
" : " << std::setw(15) << OptionType::DefaultAbsTolerance() << std::endl;
113 os << std::setw(25) <<
"Relative tolerance" <<
" : " <<std::setw(15) << OptionType::DefaultRelTolerance() << std::endl;
114 os << std::setw(25) <<
"Workspace size" <<
" : " << std::setw(15) << OptionType::DefaultWKSize() << std::endl;
116 os << std::setw(25) << OPT::DescriptionOfN() <<
" : " << std::setw(15) << OPT::N() << std::endl;
118 if (opts) opts->
Print(os);
127 fWKSize(0), fNCalls(0),
128 fAbsTolerance(0), fRelTolerance(0),
139 if (
this == &opt)
return *
this;
218 IntegOptionsUtil::PrintDefault<IntegratorOneDimOptions>(
name,os);
324 IntegOptionsUtil::PrintDefault<IntegratorMultiDimOptions>(
name,os);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Base class for Numerical integration options common in 1D and multi-dimension This is an internal cla...
int fIntegType
Integrator type (value converted from enum)
BaseIntegratorOptions()
protected constructor to avoid user creating this class
ROOT::Math::IOptions * fExtraOptions
void SetExtraOptions(const IOptions &opt)
set extra options (in this case pointer is cloned)
double fAbsTolerance
absolute tolerance
double fRelTolerance
relative tolerance
BaseIntegratorOptions & operator=(const BaseIntegratorOptions &opt)
assignment operators
unsigned int fNCalls
(max) function calls
unsigned int fWKSize
workspace size
static IOptions & Default(const char *algoname)
static IOptions * FindDefault(const char *algoname)
Generic interface for defining configuration options of a numerical algorithm.
virtual void Print(std::ostream &=std::cout) const
print options
virtual IOptions * Clone() const =0
Numerical multi dimensional integration options.
static void SetDefaultAbsTolerance(double tol)
IntegratorMultiDimOptions(IOptions *extraOpts=0)
constructor using the default options can pass a pointer to extra options (N.B.
static std::string DefaultIntegrator()
static void SetDefaultWKSize(unsigned int size)
static void SetDefaultIntegrator(const char *name)
void Print(std::ostream &os=std::cout) const
print all the options
static void SetDefaultNCalls(unsigned int ncall)
static unsigned int DefaultWKSize()
static ROOT::Math::IOptions * FindDefault(const char *name)
find specific options - return 0 if not existing
void SetIntegrator(const char *name)
set multi-dim integrator name
static IntegrationMultiDim::Type DefaultIntegratorType()
static ROOT::Math::IOptions & Default(const char *name)
retrieve specific options
static unsigned int DefaultNCalls()
static void SetDefaultRelTolerance(double tol)
static void PrintDefault(const char *name=0, std::ostream &os=std::cout)
print only the specified default options
unsigned int NCalls() const
maximum number of function calls
static double DefaultRelTolerance()
static double DefaultAbsTolerance()
std::string Integrator() const
name of multi-dim integrator
static std::string GetName(IntegrationMultiDim::Type)
static function to get a string from the enumeration
static IntegrationMultiDim::Type GetType(const char *name)
static function to get the enumeration from a string
Numerical one dimensional integration options.
static void SetDefaultNPoints(unsigned int n)
static std::string DefaultIntegrator()
static double DefaultAbsTolerance()
static void SetDefaultAbsTolerance(double tol)
static double DefaultRelTolerance()
void Print(std::ostream &os=std::cout) const
print all the options
void SetIntegrator(const char *name)
set 1D integrator name
static void SetDefaultRelTolerance(double tol)
std::string Integrator() const
name of 1D integrator
static void SetDefaultIntegrator(const char *name)
static void PrintDefault(const char *name=0, std::ostream &os=std::cout)
print only the specified default options
IntegratorOneDimOptions(IOptions *extraOpts=0)
constructor using the default options can pass a pointer to extra options (N.B.
static ROOT::Math::IOptions & Default(const char *name)
retrieve specific options - if not existing create a IOptions
static void SetDefaultWKSize(unsigned int size)
static unsigned int DefaultNPoints()
static unsigned int DefaultWKSize()
static IntegrationOneDim::Type DefaultIntegratorType()
static ROOT::Math::IOptions * FindDefault(const char *name)
find specific options - return 0 if not existing
unsigned int NPoints() const
Number of points used by current integration rule.
static std::string GetName(IntegrationOneDim::Type)
static function to get a string from the enumeration
static IntegrationOneDim::Type GetType(const char *name)
static function to get the enumeration from a string
Type
enumeration specifying the integration types.
@ kADAPTIVESINGULAR
default adaptive integration type which can be used in the case of the presence of singularities.
@ kLEGENDRE
Gauss-Legendre integration.
@ kADAPTIVE
to be used for general functions without singularities
@ kGAUSS
simple Gauss integration method with fixed rule
@ kDEFAULT
default type specifiend in the static options
Type
enumeration specifying the integration types.
@ kADAPTIVE
adaptive multi-dimensional integration
@ kDEFAULT
default type specified in the static option
Namespace for new Math classes and functions.
static double gDefaultRelTolerance
static double gDefaultAbsTolerance
static unsigned int gDefaultNCalls
static int gDefaultIntegrator
static unsigned int gDefaultWKSize
static int gDefaultIntegrator
static double gDefaultAbsTolerance
static unsigned int gDefaultWKSize
static unsigned int gDefaultNPoints
static unsigned int gDefaultNPointsGSLAdaptive
static double gDefaultRelTolerance
static unsigned int gDefaultNPointsLegendre
void PrintDefault(const char *name, std::ostream &os)
print default options
void Print(std::ostream &os, const OptionType &opt)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
IntegratorMultiDimOptions OptType
static const char * DescriptionOfN()
static int N(const OptType &opt)
static const char * DescriptionOfN()
static int N(const OptType &opt)
IntegratorOneDimOptions OptType
static int N(const OptionType &)
static const char * DescriptionOfN()