Template Struct compiled_expr_t

Struct Documentation

template<typename T>
struct compiled_expr_t

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

Template Parameters:

T – expression result type, may only be f_t for real-valued expressions or c_t for complex-valued expressions.

Public Functions

compiled_expr_t() = delete
compiled_expr_t(std::string expr, const std::vector<std::string> &variables = {})

Constructs a new compiled real-valued math expression. Throws if compilation fails.

Parameters:
  • expr – the math expression

  • variables – free variables in expr

~compiled_expr_t() noexcept
compiled_expr_t(compiled_expr_t&&) noexcept
inline std::string description() const noexcept
std::size_t get_variable_count() const noexcept
T eval(const std::vector<T> &vars = {}) const

Evaluates the expression.

Parameters:

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