Antiprism 0.23
Public Member Functions | Static Protected Member Functions

mu::Parser Class Reference

Mathematical expressions parser. More...

#include <muParser.h>

Inheritance diagram for mu::Parser:
Inheritance graph
[legend]
Collaboration diagram for mu::Parser:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

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


Constructor & Destructor Documentation

mu::Parser::Parser ( )

Constructor.

Call ParserBase class constructor and trigger Function, Operator and Constant initialization.


Member Function Documentation

value_type mu::Parser::Avg ( const value_type a_afArg,
int  a_iArgc 
) [static, protected]

Callback for averaging multiple values.

Parameters:
[in]a_afArgVector with the function arguments
[in]a_iArgcThe 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.

Parameters:
[in]a_VarPointer to the differentiation variable.
[in]a_fPosPosition at which the differentiation should take place.
[in]a_fEpsilonEpsilon 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.

See also:
DefineNameChars, DefineOprtChars, DefineInfixOprtChars

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]

Initialize operators.

By default only the unary minus operator is added.

Implements mu::ParserBase.

int mu::Parser::IsVal ( const char_type a_szExpr,
int *  a_iPos,
value_type a_fVal 
) [static, protected]

Default value recognition callback.

Parameters:
[in]a_szExprPointer to the expression
[in,out]a_iPosPointer to an index storing the current position within the expression
[out]a_fValPointer where the value should be stored in case one is found.
Returns:
1 if a value was found 0 otherwise.
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.

Parameters:
[in]a_afArgVector with the function arguments
[in]a_iArgcThe 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.

Parameters:
[in]a_afArgVector with the function arguments
[in]a_iArgcThe size of a_afArg
value_type mu::Parser::Sum ( const value_type a_afArg,
int  a_iArgc 
) [static, protected]

Callback for adding multiple values.

Parameters:
[in]a_afArgVector with the function arguments
[in]a_iArgcThe size of a_afArg
value_type mu::Parser::UnaryMinus ( value_type  v) [static, protected]

Callback for the unary minus operator.

Parameters:
vThe value to negate
Returns:
-v

The documentation for this class was generated from the following files: