Antiprism 0.23
|
Mathematical expressions parser. More...
#include <muParser.h>
Public Member Functions | |
Parser () | |
Constructor. | |
virtual void | InitCharSets () |
Define the character sets. | |
virtual void | InitFun () |
Initialize the default functions. | |
virtual void | InitConst () |
Initialize constants. | |
virtual void | InitOprt () |
Initialize operators. | |
value_type | Diff (value_type *a_Var, value_type a_fPos, value_type a_fEpsilon=0) const |
Numerically differentiate with regard to a variable. | |
Static Protected Member Functions | |
static value_type | UnaryMinus (value_type) |
Callback for the unary minus operator. | |
static value_type | Sum (const value_type *, int) |
Callback for adding multiple values. | |
static value_type | Avg (const value_type *, int) |
Callback for averaging multiple values. | |
static value_type | Min (const value_type *, int) |
Callback for determining the minimum value out of a vector. | |
static value_type | Max (const value_type *, int) |
Callback for determining the maximum value out of a vector. | |
static int | IsVal (const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) |
Default value recognition callback. |
Mathematical expressions parser.
Standard implementation of the mathematical expressions parser. Can be used as a reference implementation for subclassing the parser.
(C) 2011 Ingo Berg
muparser(at)gmx.de
mu::Parser::Parser | ( | ) |
Constructor.
Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
value_type mu::Parser::Avg | ( | const value_type * | a_afArg, |
int | a_iArgc | ||
) | [static, protected] |
Callback for averaging multiple values.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
value_type mu::Parser::Diff | ( | value_type * | a_Var, |
value_type | a_fPos, | ||
value_type | a_fEpsilon = 0 |
||
) | const |
Numerically differentiate with regard to a variable.
[in] | a_Var | Pointer to the differentiation variable. |
[in] | a_fPos | Position at which the differentiation should take place. |
[in] | a_fEpsilon | Epsilon used for the numerical differentiation. |
Numerical differentiation uses a 5 point operator yielding a 4th order formula. The default value for epsilon is 0.00074 which is numeric_limits<double>::epsilon() ^ (1/5) as suggested in the muparser forum:
http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843
void mu::Parser::InitCharSets | ( | ) | [virtual] |
Define the character sets.
This function is used for initializing the default character sets that define the characters to be useable in function and variable names and operators.
Implements mu::ParserBase.
void mu::Parser::InitConst | ( | ) | [virtual] |
Initialize constants.
By default the parser recognizes two constants. Pi ("pi") and the eulerian number ("_e").
Implements mu::ParserBase.
void mu::Parser::InitOprt | ( | ) | [virtual] |
int mu::Parser::IsVal | ( | const char_type * | a_szExpr, |
int * | a_iPos, | ||
value_type * | a_fVal | ||
) | [static, protected] |
Default value recognition callback.
[in] | a_szExpr | Pointer to the expression |
[in,out] | a_iPos | Pointer to an index storing the current position within the expression |
[out] | a_fVal | Pointer where the value should be stored in case one is found. |
value_type mu::Parser::Max | ( | const value_type * | a_afArg, |
int | a_iArgc | ||
) | [static, protected] |
Callback for determining the maximum value out of a vector.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
value_type mu::Parser::Min | ( | const value_type * | a_afArg, |
int | a_iArgc | ||
) | [static, protected] |
Callback for determining the minimum value out of a vector.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
value_type mu::Parser::Sum | ( | const value_type * | a_afArg, |
int | a_iArgc | ||
) | [static, protected] |
Callback for adding multiple values.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
value_type mu::Parser::UnaryMinus | ( | value_type | v | ) | [static, protected] |
Callback for the unary minus operator.
v | The value to negate |