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

This commit is contained in:
Arash Partow 2015-04-30 12:09:33 +10:00
parent 8a67b5b5a3
commit 8a2fc65e0a
2 changed files with 242 additions and 153 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1585,16 +1585,18 @@ as follows:
(5) function_compositor (5) function_compositor
The function compositor interface allows a user to define a function The function compositor is a factory that allows one to define and
using ExprTk syntax. The functions are limited to returning a single construct a function using ExprTk syntax. The functions are limited to
scalar value and consuming up to six parameters as input. returning a single scalar value and consuming up to six parameters as
input.
All composited functions are registered with a symbol table, allowing All composited functions are registered with a symbol table, allowing
them to call other functions that have been registered with the symbol them to call other functions that have been registered with the symbol
table instance, furthermore the functions can be recursive in nature. table instance. Furthermore the functions can be recursive in nature
The following example defines, using two different methods, composited due to the inherent function prototype forwarding that occurs during
functions then implicitly registers the functions with the denoted construction. The following example defines, by using two different
symbol table. methods, composited functions and implicitly registering the functions
with the denoted symbol table.
typedef exprtk::symbol_table<T> symbol_table_t; typedef exprtk::symbol_table<T> symbol_table_t;
typedef exprtk::function_compositor<T> compositor_t; typedef exprtk::function_compositor<T> compositor_t;
@ -1606,9 +1608,11 @@ symbol table.
// define function koo0(v1,v2) { ... } // define function koo0(v1,v2) { ... }
compositor compositor
.add("koo0", .add(
function_t(
"koo0",
" 1 + cos(v1 * v2) / 3;", " 1 + cos(v1 * v2) / 3;",
"v1","v2"); "v1","v2"));
// define function koo1(x,y,z) { ... } // define function koo1(x,y,z) { ... }
compositor compositor