Bayeux  3.4.1
Core Foundation library for SuperNEMO
multi_eval.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2009-10-04
4  * Last modified: 2013-04-11
5  *
6  * License:
7  *
8  *
9  * Description:
10  *
11  * History:
12  *
13  */
14 
15 #ifndef MYGSL_MULTI_EVAL_H
16 #define MYGSL_MULTI_EVAL_H 1
17 
18 // Standard library:
19 #include <vector>
20 
21 // This project:
22 #include <mygsl/i_unary_function.h>
23 #include <mygsl/interval.h>
24 
25 namespace mygsl {
26 
28  class multi_eval
29  {
30  public:
31 
32  typedef std::vector<interval> multi_domain;
33 
34  public:
35 
36  multi_eval (size_t dimension_);
37 
38  virtual ~multi_eval ();
39 
40  public:
41 
42  size_t get_dimension () const;
43 
44  interval & get_domain (int i_);
45 
46  const interval & get_domain (int i_) const;
47 
48  bool is_valid (const double * x_) const;
49 
50  virtual bool is_valid (int i_, double x_) const;
51 
52  double evaluate (double x_) const;
53 
54  double evaluate (double x_, double y_) const;
55 
56  double evaluate (double x_, double y_, double z_) const;
57 
58  double evaluate (const std::vector<double> & v_) const;
59 
60  double evaluate (const double * x_) const;
61 
62  double operator () (const double * x_) const;
63 
64  // to feed the GSL gsl_function interface:
65  static double g_function (const double * x_, void * functor_);
66 
67  protected:
68 
69  virtual double _eval(const double * x_) const = 0;
70 
71  private:
72 
73  void _check_dimension_ (size_t dim_) const;
74 
75  private:
76 
77  multi_domain _domains_;
78 
79  };
80 
82  {
83 
84  public:
85 
86  bool is_valid (double x_) const;
87 
88  const double & param (int i_) const;
89 
90  double & param (int i_);
91 
92  void init (const multi_eval & multi_eval_,
93  int i_,
94  const std::vector<double> & params_);
95 
96  void set_index (int i_);
97 
98  unary_eval_from_multi (const multi_eval & multi_eval_,
99  int i_,
100  const std::vector<double> & params_);
101 
102  unary_eval_from_multi (const multi_eval & multi_eval_,
103  int i_,
104  const double * params_);
105 
106  virtual ~unary_eval_from_multi ();
107 
108  protected:
109 
110  double _eval(double x_) const;
111 
112  private:
113 
114  int _index_;
115  const multi_eval * _multi_eval_;
116  std::vector<double> _params_;
117 
118  };
119 
120 } // end of namespace mygsl
121 
122 #endif // MYGSL_MULTI_EVAL_H
123 
124 /* Local Variables: */
125 /* mode: c++ */
126 /* coding: utf-8 */
127 /* End: */
Definition: multi_eval.h:81
Abstract functor from a R^n space to R.
Definition: multi_eval.h:28
static double g_function(const double *x_, void *functor_)
std::vector< interval > multi_domain
Definition: multi_eval.h:32
double operator()(const double *x_) const
interval & get_domain(int i_)
bool is_valid(const double *x_) const
const double & param(int i_) const
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
virtual double _eval(const double *x_) const =0
size_t get_dimension() const
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
void init(const multi_eval &multi_eval_, int i_, const std::vector< double > &params_)
virtual ~multi_eval()
multi_eval(size_t dimension_)
unary_eval_from_multi(const multi_eval &multi_eval_, int i_, const std::vector< double > &params_)
double _eval(double x_) const
The function evaluation abstract method.
bool is_valid(double x_) const
An interval with real bounds.
Definition: interval.h:42
double evaluate(double x_) const