27 template <
class T=
double>
28 inline std::function<T(T)>
35 exprtk::symbol_table<T> symbol_table;
36 symbol_table.add_variable(
"x",x);
37 symbol_table.add_constants();
39 exprtk::expression<T> expression;
40 expression.register_symbol_table(symbol_table);
42 exprtk::parser<T> parser;
43 parser.compile(funcStr ,expression);
45 T result = expression.value();
58 template <
class T=
double>
59 inline std::function<T(std::vector<T>)>
63 [funcStr](
const std::vector<T>& xval)
65 std::vector<T> x(xval);
66 exprtk::symbol_table<T> symbol_table;
67 symbol_table.add_vector(
"x",x);
68 symbol_table.add_constants();
70 exprtk::expression<T> expression;
71 expression.register_symbol_table(symbol_table);
73 exprtk::parser<T> parser;
74 parser.compile(funcStr,expression);
76 T result = expression.value();
std::function< T(std::vector< T >)> GetVectorFunctionFromString(const std::string &funcStr)
std::function< T(T)> GetScalarFunctionFromString(const std::string &funcStr)