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 !=
nullptr) ?
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),
129 fExtraOptions(nullptr)
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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 IOptions * Clone() const =0
virtual void Print(std::ostream &=std::cout) const
print options
Numerical multi dimensional integration options.
static void SetDefaultAbsTolerance(double tol)
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)
IntegratorMultiDimOptions(IOptions *extraOpts=nullptr)
constructor using the default options can pass a pointer to extra options (N.B.
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)
std::string Integrator() const override
name of multi-dim integrator
unsigned int NCalls() const
maximum number of function calls
static double DefaultRelTolerance()
static double DefaultAbsTolerance()
static void PrintDefault(const char *name=nullptr, std::ostream &os=std::cout)
print only the specified default options
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()
IntegratorOneDimOptions(IOptions *extraOpts=nullptr)
constructor using the default options can pass a pointer to extra options (N.B.
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)
static void SetDefaultIntegrator(const char *name)
static ROOT::Math::IOptions & Default(const char *name)
retrieve specific options - if not existing create a IOptions
static void SetDefaultWKSize(unsigned int size)
std::string Integrator() const override
name of 1D integrator
static unsigned int DefaultNPoints()
static void PrintDefault(const char *name=nullptr, std::ostream &os=std::cout)
print only the specified default options
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 specified 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)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
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()