16 #include "RConfigure.h"
30 namespace IntegOneDim {
32 #ifdef R__HAS_MATHMORE
47 namespace IntegMultiDim {
63 namespace IntegOptionsUtil {
67 template<
class OptionType>
69 static int N() {
return 0; }
70 static int N(
const OptionType & ) {
return 0; }
71 static const char * DescriptionOfN() {
return 0; }
74 struct OptionTrait<IntegratorOneDimOptions> {
75 typedef IntegratorOneDimOptions OptType;
76 static int N() {
return OptType::DefaultNPoints(); }
77 static int N(
const OptType & opt) {
return opt.NPoints(); }
78 static const char * DescriptionOfN() {
return "Rule (Npoints)";}
81 struct OptionTrait<IntegratorMultiDimOptions> {
82 typedef IntegratorMultiDimOptions OptType;
83 static int N() {
return OptType::DefaultNCalls(); }
84 static int N(
const OptType & opt) {
return opt.NCalls(); }
85 static const char * DescriptionOfN() {
return "(max) function calls";}
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;
97 typedef OptionTrait<OptionType>
OPT;
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;
115 typedef OptionTrait<OptionType>
OPT;
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);
static double DefaultAbsTolerance()
static ROOT::Math::IOptions * FindDefault(const char *name)
static IntegrationMultiDim::Type GetType(const char *name)
static function to get the enumeration from a string
static unsigned int gDefaultWKSize
void SetExtraOptions(const IOptions &opt)
set extra options (in this case pointer is cloned)
static void PrintDefault(const char *name=0, std::ostream &os=std::cout)
print only the specified default options
Type
enumeration specifying the integration types.
static unsigned int gDefaultNPoints
static unsigned int gDefaultNPointsGSLAdaptive
static double gDefaultAbsTolerance
static void SetDefaultIntegrator(const char *name)
static void SetDefaultWKSize(unsigned int size)
static void SetDefaultIntegrator(const char *name)
static unsigned int DefaultNPoints()
void PrintDefault(const char *name, std::ostream &os)
print default options
static void PrintDefault(const char *name=0, std::ostream &os=std::cout)
print only the specified default options
void Print(std::ostream &os=std::cout) const
print all the options
static void SetDefaultAbsTolerance(double tol)
static std::string DefaultIntegrator()
static unsigned int gDefaultNPointsLegendre
static unsigned int DefaultWKSize()
BaseIntegratorOptions & operator=(const BaseIntegratorOptions &opt)
assignment operators
IntegratorMultiDimOptions(IOptions *extraOpts=0)
static int gDefaultIntegrator
static void SetDefaultNCalls(unsigned int ncall)
static unsigned int gDefaultNCalls
ROOT::Math::IOptions * fExtraOptions
static unsigned int gDefaultWKSize
void Print(std::ostream &os=std::cout) const
print all the options
static double DefaultRelTolerance()
IntegratorOneDimOptions(IOptions *extraOpts=0)
static IntegrationOneDim::Type DefaultIntegratorType()
static void SetDefaultRelTolerance(double tol)
static ROOT::Math::IOptions & Default(const char *name)
static std::string DefaultIntegrator()
static IntegrationOneDim::Type GetType(const char *name)
static function to get the enumeration from a string
void SetIntegrator(const char *name)
set multi-dim integrator name
static int gDefaultIntegrator
static std::string GetName(IntegrationMultiDim::Type)
static function to get a string from the enumeration
virtual IOptions * Clone() const =0
Base class for Numerical integration options common in 1D and multi-dimension This is an internal cla...
static double gDefaultRelTolerance
static IntegrationMultiDim::Type DefaultIntegratorType()
Type
enumeration specifying the integration types.
virtual void Print(std::ostream &=std::cout) const
print options
static ROOT::Math::IOptions & Default(const char *name)
retrieve specific options - if not existing create a IOptions
void Print(std::ostream &os, const OptionType &opt)
static void SetDefaultRelTolerance(double tol)
static void SetDefaultNPoints(unsigned int n)
static ROOT::Math::IOptions * FindDefault(const char *name)
static double DefaultAbsTolerance()
std::string Integrator() const
name of multi-dim integrator
static std::string GetName(IntegrationOneDim::Type)
static function to get a string from the enumeration
static IOptions & Default(const char *algoname)
Generic interface for defining configuration options of a numerical algorithm.
static double gDefaultRelTolerance
static double gDefaultAbsTolerance
std::string Integrator() const
name of 1D integrator
BaseIntegratorOptions()
protected constructor to avoid user creating this class
static IOptions * FindDefault(const char *algoname)
static unsigned int DefaultWKSize()
static double DefaultRelTolerance()
void SetIntegrator(const char *name)
set 1D integrator name
static void SetDefaultAbsTolerance(double tol)
static void SetDefaultWKSize(unsigned int size)
static unsigned int DefaultNCalls()