32#include <exprtk/exprtk.hpp>
35 static std::mutex parser_mutex;
36 static exprtk::parser<double> parser;
50 Expression(
unsigned, std::vector<std::string>&&);
59 [[nodiscard]] virtual uword
input_size() const;
62 bool compile(const std::string_view&);
63 static std::
string error();
66 virtual Mat<
double>
evaluate(const Col<
double>&) = 0;
69 virtual Mat<
double>
gradient(const Col<
double>&) = 0;
71 void print() override;
80 Mat<double>
evaluate(
const Col<double>&)
override;
82 Mat<double>
gradient(
const Col<double>&)
override;
95 Mat<double>
evaluate(
const Col<double>&)
override;
97 Mat<double>
gradient(
const Col<double>&)
override {
throw std::runtime_error(
"gradient is not implemented for vector expression"); }
A Expression class represents a maths expression.
Definition: Expression.h:34
Mat< double > gradient(double)
Definition: Expression.cpp:56
virtual unique_ptr< Expression > get_copy() const =0
exprtk::expression< double > expression
Definition: Expression.h:45
Mat< double > evaluate(double)
Definition: Expression.cpp:54
void print() override
Definition: Expression.cpp:58
Expression(unsigned, std::vector< std::string > &&)
Definition: Expression.cpp:24
virtual uword output_size() const
Definition: Expression.cpp:44
Expression(Expression &&) noexcept=delete
std::string expression_text
Definition: Expression.h:41
static std::string error()
Definition: Expression.cpp:52
virtual uword input_size() const
Definition: Expression.cpp:42
Col< double > x
Definition: Expression.h:39
std::vector< std::string > variable_text_list
Definition: Expression.h:43
exprtk::symbol_table< double > symbol_table
Definition: Expression.h:47
Expression(const Expression &)=delete
bool compile(const std::string_view &)
Definition: Expression.cpp:46
Definition: Expression.h:74
Definition: Expression.h:85
Mat< double > gradient(const Col< double > &) override
Definition: Expression.h:97
A base Tag class.
Definition: Tag.h:38