| 17 | { |
| 18 | |
| 19 | class TestFunction : public Function |
| 20 | { |
| 21 | public: |
| 22 | TestFunction(std::function<double (const std::vector<double> &)> f, size_t numVariables, |
| 23 | std::string functionString); |
| 24 | TestFunction(std::function<double (const std::vector<double> &)> f, size_t numVariables, |
| 25 | std::string functionString, DenseMatrix powers); |
| 26 | |
| 27 | virtual ~TestFunction(); |
| 28 | |
| 29 | /** |
| 30 | * Avoid name hiding. |
| 31 | * Overriding a method that is overloaded causes all methods with the same name |
| 32 | * to be hidden. Doing this avoids that "problem" (it is actually a feature). |
| 33 | */ |
| 34 | using Function::eval; |
| 35 | double eval(DenseVector x) const override; |
| 36 | |
| 37 | inline std::string getFunctionStr() const { return functionString; } |
| 38 | |
| 39 | inline bool isConstDegree() const { return constDegree; } |
| 40 | |
| 41 | // Returns the maximum degree of each dimension |
| 42 | std::vector<unsigned int> getConstDegreeInt() const; |
| 43 | |
| 44 | double getMaxDegree() const; |
| 45 | |
| 46 | DenseMatrix getPowers() const |
| 47 | { |
| 48 | return powers; |
| 49 | } |
| 50 | |
| 51 | void save(const std::string &fileName) const override {} |
| 52 | |
| 53 | |
| 54 | DenseMatrix powers; |
| 55 | private: |
| 56 | std::string functionString; |
| 57 | |
| 58 | bool constDegree; |
| 59 | |
| 60 | std::function<double (const std::vector<double> &)> f; |
| 61 | |
| 62 | void load(const std::string &fileName) override {} |
| 63 | }; |
| 64 | |
| 65 | } // namespace SPLINTER |
| 66 |
nothing calls this directly
no outgoing calls
no test coverage detected