bpp-core3  3.0.0
FunctionTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_FUNCTION_FUNCTIONTOOLS_H
6 #define BPP_NUMERIC_FUNCTION_FUNCTIONTOOLS_H
7 
8 
9 #include "../VectorTools.h"
10 #include "../DataTable.h"
11 #include "Functions.h"
12 
13 namespace bpp
14 {
21 {
22 private:
23  std::vector<std::string> names_;
25 
26 public:
27  ParameterGrid() : names_(), grid_() {}
28  virtual ~ParameterGrid() {}
29 
30 public:
38  void addDimension(const std::string& name, const Vdouble& values);
39 
40  const std::vector<std::string>& getDimensionNames() const { return names_; }
41 
42  const std::string& getDimensionName(unsigned int i) const
43  {
44  if (i >= names_.size()) throw IndexOutOfBoundsException("ParameterGrid::getDimensionName().", i, 0, names_.size() - 1);
45  return names_[i];
46  }
47 
48  size_t getNumberOfDimensions() const { return names_.size(); }
49 
53  size_t getTotalNumberOfPoints() const;
54 
55  const VVdouble& getPoints() const { return grid_; }
56  const Vdouble& getPointsForDimension(unsigned int i) const;
57  const Vdouble& getPointsForDimension(const std::string& name) const;
58 };
59 
64 {
65 public:
78  static std::shared_ptr<DataTable> computeGrid(
79  FunctionInterface& function,
80  const ParameterGrid& grid);
81 };
82 } // end of namespace bpp
83 #endif // BPP_NUMERIC_FUNCTION_FUNCTIONTOOLS_H
const std::string & getDimensionName(unsigned int i) const
Definition: FunctionTools.h:42
std::vector< std::string > names_
Definition: FunctionTools.h:23
This is the function abstract class.
Definition: Functions.h:52
This class is a data structure to specify a set of parameter values (most likely for evaluation by a ...
Definition: FunctionTools.h:20
size_t getTotalNumberOfPoints() const
virtual ~ParameterGrid()
Definition: FunctionTools.h:28
const VVdouble & getPoints() const
Definition: FunctionTools.h:55
std::vector< double > Vdouble
Definition: VectorTools.h:34
size_t getNumberOfDimensions() const
Definition: FunctionTools.h:48
Index out of bounds exception class.
Definition: Exceptions.h:131
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:35
This class contains static methods to deal with Function objects.
Definition: FunctionTools.h:63
const std::vector< std::string > & getDimensionNames() const
Definition: FunctionTools.h:40