Struct compiled_math_expression_t

Struct Documentation

struct compiled_math_expression_t

Compiles a math expression defined via a string with free variable, and enables efficient run-time evaluation.

Public Functions

compiled_math_expression_t() = delete
compiled_math_expression_t(std::string expr, const std::vector<std::string> &variables)

Constructs a new compiled math expression. Throws if compilation fails.

Parameters:
  • expr – the math expression

  • variables – free variables in expr

~compiled_math_expression_t()
compiled_math_expression_t(compiled_math_expression_t&&) noexcept
inline const auto &description() const noexcept
std::size_t get_variable_count() const noexcept
f_t eval(const std::vector<f_t> &vars = {}) const

Evaluates the expression. Variables and expression result are evaluated with type f_t.

Parameters:

vars – list of values for the free variables; must be of same length as the variables parameter for the ctor