bpp-core  2.2.0
FunctionTools.h
Go to the documentation of this file.
1 //
2 // File: FunctionTools.h
3 // Created by: Julien Dutheil
4 // Created on: Mon Apr 13 10:00 2009
5 //
6 
7 /*
8 Copyright or © or Copr. CNRS, (November 17, 2004)
9 
10 This software is a computer program whose purpose is to provide classes
11 for numerical calculus.
12 
13 This software is governed by the CeCILL license under French law and
14 abiding by the rules of distribution of free software. You can use,
15 modify and/ or redistribute the software under the terms of the CeCILL
16 license as circulated by CEA, CNRS and INRIA at the following URL
17 "http://www.cecill.info".
18 
19 As a counterpart to the access to the source code and rights to copy,
20 modify and redistribute granted by the license, users are provided only
21 with a limited warranty and the software's author, the holder of the
22 economic rights, and the successive licensors have only limited
23 liability.
24 
25 In this respect, the user's attention is drawn to the risks associated
26 with loading, using, modifying and/or developing or reproducing the
27 software by the user in light of its specific status of free software,
28 that may mean that it is complicated to manipulate, and that also
29 therefore means that it is reserved for developers and experienced
30 professionals having in-depth computer knowledge. Users are therefore
31 encouraged to load and test the software's suitability as regards their
32 requirements in conditions enabling the security of their systems and/or
33 data to be ensured and, more generally, to use and operate it in the
34 same conditions as regards security.
35 
36 The fact that you are presently reading this means that you have had
37 knowledge of the CeCILL license and that you accept its terms.
38 */
39 
40 #ifndef _FUNCTIONTOOLS_H_
41 #define _FUNCTIONTOOLS_H_
42 
43 #include "Functions.h"
44 #include "../VectorTools.h"
45 
46 namespace bpp
47 {
48 
55 {
56  private:
57  std::vector<std::string> names_;
59 
60  public:
62  virtual ~ParameterGrid() {}
63 
64  public:
72  void addDimension(const std::string& name, const Vdouble& values) throw (Exception);
73 
74  const std::vector<std::string>& getDimensionNames() const { return names_; }
75 
76  const std::string& getDimensionName(unsigned int i) const throw (IndexOutOfBoundsException)
77  {
78  if (i >= names_.size()) throw IndexOutOfBoundsException("ParameterGrid::getDimensionName().", i, 0, names_.size()-1);
79  return names_[i];
80  }
81 
82  size_t getNumberOfDimensions() const { return names_.size(); }
83 
87  size_t getTotalNumberOfPoints() const;
88 
89  const VVdouble& getPoints() const { return grid_; }
90  const Vdouble& getPointsForDimension(unsigned int i) const throw (IndexOutOfBoundsException);
91  const Vdouble& getPointsForDimension(const std::string& name) const throw (Exception);
92 };
93 
98 {
99  public:
114  static VVdouble* computeGrid(
115  Function& function,
116  const ParameterGrid& grid) throw (Exception);
117 };
118 
119 } //end of namespace bpp
120 
121 #endif //_FUNCTIONTOOLS_H_
122 
const std::string & getDimensionName(unsigned int i) const
Definition: FunctionTools.h:76
This class allows to perform a correspondence analysis.
This is the function abstract class.
Definition: Functions.h:86
std::vector< std::string > names_
Definition: FunctionTools.h:57
static VVdouble * computeGrid(Function &function, const ParameterGrid &grid)
Evaluates a function on all points in a given grid.
This class is a data structure to specify a set of parameter values (most likely for evaluation by a ...
Definition: FunctionTools.h:54
size_t getTotalNumberOfPoints() const
virtual ~ParameterGrid()
Definition: FunctionTools.h:62
const VVdouble & getPoints() const
Definition: FunctionTools.h:89
std::vector< double > Vdouble
Definition: VectorTools.h:67
size_t getNumberOfDimensions() const
Definition: FunctionTools.h:82
Exception base class.
Definition: Exceptions.h:57
Index out of bounds exception class.
Definition: Exceptions.h:298
const Vdouble & getPointsForDimension(unsigned int i) const
void addDimension(const std::string &name, const Vdouble &values)
Add a new dimension (parameter name + corresponding values).
std::vector< Vdouble > VVdouble
Definition: VectorTools.h:68
This class contains static methods to deal with Function objects.
Definition: FunctionTools.h:97
const std::vector< std::string > & getDimensionNames() const
Definition: FunctionTools.h:74