3 #ifndef MYGSL_I_UNARY_FUNCTION_H 4 #define MYGSL_I_UNARY_FUNCTION_H 1 16 #include <boost/cstdint.hpp> 45 :
public std::unary_function<double,double>
81 virtual double eval(
double x_)
const;
115 double min_,
double max_,
unsigned int nsamples_,
116 int x_precision_ = 16,
117 int fx_precision_ = 16,
122 double min_,
double max_,
unsigned int nsamples_,
125 int x_precision_ = 16,
126 int fx_precision_ = 16,
131 double min_,
double max_,
unsigned int nsamples_,
132 int x_precision_ = 16,
133 int fx_precision_ = 16,
138 double min_,
double max_,
unsigned int nsamples_,
139 const std::string & x_unit_label_,
140 const std::string & fx_unit_label_,
141 int x_precision_ = 16,
142 int fx_precision_ = 16,
146 static double g_function(
double x_,
void * functor_);
168 virtual void reset();
174 virtual void tree_dump(std::ostream & out_ = std::clog,
175 const std::string & title_ =
"",
176 const std::string & indent_ =
"",
177 bool inherit_ =
false)
const;
182 virtual double _eval(
double x_)
const = 0;
206 #define MYGSL_UNARY_FUNCTOR_REGISTRATION_INTERFACE(UnaryFunctorClass) \ 208 DATATOOLS_FACTORY_SYSTEM_AUTO_REGISTRATION_INTERFACE(::mygsl::i_unary_function, UnaryFunctorClass ) \ 211 #define MYGSL_UNARY_FUNCTOR_REGISTRATION_IMPLEMENT(UnaryFunctorClass,UnaryFunctorClassId) \ 212 DATATOOLS_FACTORY_SYSTEM_AUTO_REGISTRATION_IMPLEMENTATION(::mygsl::i_unary_function, UnaryFunctorClass , UnaryFunctorClassId ) \ 215 #endif // MYGSL_I_UNARY_FUNCTION_H bool has_zero_domain() const
Check if the functor has an explicit zero domain.
void write_ascii(std::ostream &fout_, double min_, double max_, unsigned int nsamples_, int x_precision_=16, int fx_precision_=16, uint32_t options_=wo_default) const
Write the (x,y=f(x)) value pairs in an ASCII stream :
Definition: i_unary_function.h:65
virtual ~i_unary_function()
Destructor.
write_options_type
Options for writing sampled function in an ASCII stream.
Definition: i_unary_function.h:57
double operator()(double x_) const
Standard C++ functor interface.
static const double AUTO_EPSILON
Value for automatic computation of the error.
Definition: i_unary_function.h:54
virtual double _eval(double x_) const =0
The function evaluation abstract method.
virtual double eval_no_check(double x_) const
The function evaluation method with any value check.
Do not print (x,y=f(x)) pairs if y is a NaN.
Definition: i_unary_function.h:60
Do not print (x,y=f(x)) pairs if y is a +/-infinity.
Definition: i_unary_function.h:61
void write_ascii_with_units(std::ostream &fout_, double min_, double max_, unsigned int nsamples_, double x_unit_, double fx_unit_, int x_precision_=16, int fx_precision_=16, uint32_t options_=wo_default) const
Write the (x,y=f(x)) value pairs in an ASCII stream :
Do not print (x,y=f(x)) pairs if x lies out of domain of definition.
Definition: i_unary_function.h:63
static const double DEFAULT_EPSILON
Default error.
Definition: i_unary_function.h:51
void set_epsilon(double)
Set the precision.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart printing.
double get_epsilon() const
Return the precision.
void initialize_standalone(const datatools::properties &config_)
Initialization from a container of parameters.
void _compute_auto_epsilon()
Append to an existing file.
Definition: i_unary_function.h:64
static double g_function(double x_, void *functor_)
A generic static function to feed the GSL gsl_function interface:
void _base_initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
virtual double get_non_zero_domain_max() const
The maximum bound of the non-zero domain (default is plus infinity)
i_unary_function(double epsilon_=0.0)
Constructor.
virtual void reset()
Reset the functor.
void initialize_simple()
Simple initialization.
Definition: i_unary_function.h:58
virtual double get_non_zero_domain_min() const
The minimum bound of the non-zero domain (default is minus infinity)
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
double evaluate(double x_) const
The function evaluation method.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
bool is_in_zero_domain(double x_) const
Check if a value is in the zero domain.
Do not print (x,y=f(x)) pairs if x lies out of the non-zero domain.
Definition: i_unary_function.h:62
virtual bool is_initialized() const
Check initialization status.
std::map< std::string, unary_function_handle_type > unary_function_dict_type
Alias for dictionary of handles to unary function objects.
Definition: unary_function_utils.h:30
virtual void initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
void write_ascii_file(const std::string &filename_, double min_, double max_, unsigned int nsamples_, int x_precision_=16, int fx_precision_=16, uint32_t options_=wo_default) const
Write the (x,y=f(x)) value pairs in an ASCII file (typical Gnuplot input) :
void _set_defaults()
Set defaults attributes.
Store as a data index for Gnuplot (2 blank lines at the end)
Definition: i_unary_function.h:59
bool has_non_zero_domain_min() const
Check the minimum bound of the non-zero domain.
virtual bool is_in_domain_of_definition(double x_) const
Check if a value is in the domain of definition of the function (default: true)
void write_ascii_file_with_units(const std::string &filename_, double min_, double max_, unsigned int nsamples_, const std::string &x_unit_label_, const std::string &fx_unit_label_, int x_precision_=16, int fx_precision_=16, uint32_t options_=wo_default) const
Write the (x,y=f(x)) value pairs in an ASCII file (typical Gnuplot input) :
#define DATATOOLS_FACTORY_SYSTEM_REGISTER_INTERFACE(BaseType)
Declaration of a system (allocator/functor) factory register as a static member of a base class and s...
Definition: factory_macros.h:52
virtual bool has_explicit_domain_of_definition() const
Check if the function has an explicit domain of definition (default: false)
virtual double eval(double x_) const
The function evaluation method.
bool is_in_non_zero_domain(double x_) const
Check if a value is in the non-zero domain.
bool has_non_zero_domain_max() const
Check the maximum bound of the non-zero domain.