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; }
71 static const char * DescriptionOfN() {
return 0; }
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)";}
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);
Base class for Numerical integration options common in 1D and multi-dimension This is an internal cla...
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)
BaseIntegratorOptions & operator=(const BaseIntegratorOptions &opt)
assignment operators
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)
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)
void SetIntegrator(const char *name)
set multi-dim integrator name
static IntegrationMultiDim::Type DefaultIntegratorType()
static ROOT::Math::IOptions & Default(const char *name)
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
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)
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)
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.
Type
enumeration specifying the integration types.
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)