MCPcopy Create free account
hub / github.com/bgrimstad/splinter / TestFunction

Class TestFunction

test/testfunction.h:19–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17{
18
19class TestFunction : public Function
20{
21public:
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;
55private:
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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected