C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html

This commit is contained in:
Arash Partow 2013-12-30 21:09:57 +11:00
parent 40a9551e5c
commit d7cebf71cb
15 changed files with 29 additions and 32 deletions

View File

@ -2,7 +2,7 @@
# ************************************************************** # **************************************************************
# * C++ Mathematical Expression Toolkit Library * # * C++ Mathematical Expression Toolkit Library *
# * * # * *
# * Author: Arash Partow (1999-2013) * # * Author: Arash Partow (1999-2014) *
# * URL: http://www.partow.net/programming/exprtk/index.html * # * URL: http://www.partow.net/programming/exprtk/index.html *
# * * # * *
# * Copyright notice: * # * Copyright notice: *

View File

@ -2,7 +2,7 @@
****************************************************************** ******************************************************************
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *
@ -9949,8 +9949,6 @@ namespace exprtk
typedef details::T0oT1oT2oT3_define<T,const_t, cref_t, cref_t,const_t> covovoc_t; typedef details::T0oT1oT2oT3_define<T,const_t, cref_t, cref_t,const_t> covovoc_t;
typedef details::T0oT1oT2oT3_define<T, cref_t,const_t,const_t, cref_t> vococov_t; typedef details::T0oT1oT2oT3_define<T, cref_t,const_t,const_t, cref_t> vococov_t;
struct range_pack;
public: public:
enum precompilation_step enum precompilation_step

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* ExprTk vs Native Benchmarks * * ExprTk vs Native Benchmarks *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 1 * * Simple Example 1 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 2 * * Simple Example 2 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 3 * * Simple Example 3 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 4 * * Simple Example 4 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 5 * * Simple Example 5 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 6 * * Simple Example 6 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 7 * * Simple Example 7 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 8 * * Simple Example 8 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 9 * * Simple Example 9 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Simple Example 10 * * Simple Example 10 *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *

View File

@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library * * C++ Mathematical Expression Toolkit Library *
* * * *
* Examples and Unit-Tests * * Examples and Unit-Tests *
* Author: Arash Partow (1999-2013) * * Author: Arash Partow (1999-2014) *
* URL: http://www.partow.net/programming/exprtk/index.html * * URL: http://www.partow.net/programming/exprtk/index.html *
* * * *
* Copyright notice: * * Copyright notice: *
@ -3658,7 +3658,6 @@ inline bool run_test19()
typedef exprtk::symbol_table<T> symbol_table_t; typedef exprtk::symbol_table<T> symbol_table_t;
typedef exprtk::expression<T> expression_t; typedef exprtk::expression<T> expression_t;
typedef exprtk::parser<T> parser_t; typedef exprtk::parser<T> parser_t;
typedef exprtk::parser_error::type error_t;
typedef exprtk::function_compositor<T> compositor_t; typedef exprtk::function_compositor<T> compositor_t;
typedef typename compositor_t::function function_t; typedef typename compositor_t::function function_t;
@ -3685,7 +3684,7 @@ inline bool run_test19()
// gof(x) = g(f(x)) // gof(x) = g(f(x))
compositor.add("gof","g(f(x))","x"); compositor.add("gof","g(f(x))","x");
exprtk::symbol_table<T>& symbol_table = compositor.symbol_table(); symbol_table_t& symbol_table = compositor.symbol_table();
symbol_table.add_constants(); symbol_table.add_constants();
symbol_table.add_variable("x",x); symbol_table.add_variable("x",x);
@ -3707,7 +3706,7 @@ inline bool run_test19()
expression_t expression; expression_t expression;
expression.register_symbol_table(symbol_table); expression.register_symbol_table(symbol_table);
exprtk::parser<T> parser; parser_t parser;
if (!parser.compile(expr_str_list[i],expression)) if (!parser.compile(expr_str_list[i],expression))
{ {
@ -3782,7 +3781,7 @@ inline bool run_test19()
.var("x").var("y").var("z") .var("x").var("y").var("z")
.var("w").var("u").var("v")); .var("w").var("u").var("v"));
exprtk::symbol_table<T>& symbol_table = compositor.symbol_table(); symbol_table_t& symbol_table = compositor.symbol_table();
symbol_table.add_constants(); symbol_table.add_constants();
symbol_table.add_variable("x",x); symbol_table.add_variable("x",x);
symbol_table.add_variable("y",y); symbol_table.add_variable("y",y);
@ -3794,7 +3793,7 @@ inline bool run_test19()
expression_t expression; expression_t expression;
expression.register_symbol_table(symbol_table); expression.register_symbol_table(symbol_table);
exprtk::parser<T> parser; parser_t parser;
std::string expression_str = "f6(x,y,z,w,u,v) + 2"; std::string expression_str = "f6(x,y,z,w,u,v) + 2";
@ -3878,7 +3877,7 @@ inline bool run_test19()
"} ", "} ",
"x"); "x");
exprtk::symbol_table<T>& symbol_table = compositor.symbol_table(); symbol_table_t& symbol_table = compositor.symbol_table();
symbol_table.add_constants(); symbol_table.add_constants();
symbol_table.add_variable("x",x); symbol_table.add_variable("x",x);
@ -3893,7 +3892,7 @@ inline bool run_test19()
expression2.register_symbol_table(symbol_table); expression2.register_symbol_table(symbol_table);
expression3.register_symbol_table(symbol_table); expression3.register_symbol_table(symbol_table);
exprtk::parser<T> parser; parser_t parser;
if (!parser.compile(expression_str1,expression1)) if (!parser.compile(expression_str1,expression1))
{ {
@ -4041,7 +4040,7 @@ inline bool run_test19()
"fibonacci_impl4(x,0,1,0)", "fibonacci_impl4(x,0,1,0)",
"x"); "x");
exprtk::symbol_table<T>& symbol_table = compositor.symbol_table(); symbol_table_t& symbol_table = compositor.symbol_table();
symbol_table.add_constants(); symbol_table.add_constants();
symbol_table.add_variable("x",x); symbol_table.add_variable("x",x);
@ -4059,7 +4058,7 @@ inline bool run_test19()
expression3.register_symbol_table(symbol_table); expression3.register_symbol_table(symbol_table);
expression4.register_symbol_table(symbol_table); expression4.register_symbol_table(symbol_table);
exprtk::parser<T> parser; parser_t parser;
if (!parser.compile(expression_str1,expression1)) if (!parser.compile(expression_str1,expression1))
{ {
@ -4162,7 +4161,7 @@ inline bool run_test19()
{ {
T x = T(0); T x = T(0);
exprtk::symbol_table<T> symbol_table; symbol_table_t symbol_table;
symbol_table.add_constants(); symbol_table.add_constants();
symbol_table.add_variable("x",x); symbol_table.add_variable("x",x);
@ -4199,7 +4198,7 @@ inline bool run_test19()
expression.register_symbol_table(symbol_table); expression.register_symbol_table(symbol_table);
exprtk::parser<T> parser; parser_t parser;
if (!parser.compile(expression_str,expression)) if (!parser.compile(expression_str,expression))
{ {

View File

@ -557,12 +557,12 @@ correctly optimize such expressions for a given architecture.
(18) Recursive calls made from within composited functions will have (18) Recursive calls made from within composited functions will have
a stack size bound by the stack of the executing architecture. a stack size bound by the stack of the executing architecture.
(19) The following are examples of floating point value represenations (19) The following are examples of compliant floating point value
that are supported: representations:
(a) 12345 (b) -123.456 (a) 12345 (b) -123.456
(c) +123.456e+12 (d) 123.456E-12 (c) +123.456e+12 (d) 123.456E-12
(c) +012.045e+07 (e) .1234 (e) +012.045e+07 (f) .1234
(f) 123.456f (f) -321.654E+3L (g) 123.456f (h) -321.654E+3L
(20) Expressions may contain any of the following comment styles: (20) Expressions may contain any of the following comment styles:
1. // .... \n 1. // .... \n
@ -583,7 +583,7 @@ struct myfunc : public exprtk::ifunction<T>
{ {
myfunc() : exprtk::ifunction<T>(2) {} myfunc() : exprtk::ifunction<T>(2) {}
inline T operator()(const T& v1, const T& v2) T operator()(const T& v1, const T& v2)
{ {
return T(1) + (v1 * v2) / T(3); return T(1) + (v1 * v2) / T(3);
} }