|
Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
|
#include <muParserXInterface.hpp>
Public Member Functions | |
| muParserXInterface () | |
| Default constructor. | |
| muParserXInterface (const std::string expression) | |
| Constructor that takes a string containing muParserX expression. | |
| muParserXInterface (muParserXInterface const &mpi) | |
| muParserXInterface | operator= (muParserXInterface const &mpi) |
| void | set_expression (const std::string &e) |
| Sets the muparserX expression. | |
| auto | operator() (ArgumentType const &x) const |
Static Public Member Functions | |
| static muParserXInterface | fromFile (const std::string &filename) |
An interface to MuParserX to define a function
It define a functor representing a function \( R^N \) to \( R\) The input variables are defined as x[0] x[1] etc and one can use the muparserX syntax to create the expression.
I assume that at compile time we know the size of the argument of the function and I keep the return value as template parameter. By default both input and output are arrays. The input variables are indicated by x[]. An example of a valid expression: sin(x[0])+x[1]*x[2]
| N | The number of arguments of the function we want to represent |
| ArgumentType | any type that support the addressing ([]) operator |
Definition at line 30 of file muParserXInterface.hpp.
|
inline |
Default constructor.
mup::pckALL_NON_COMPLEX|mup::pckMATRIX means that I do not want the module for complex numbers but I want to treat arrays and matrices in muparserX expressions
Definition at line 38 of file muParserXInterface.hpp.
|
inline |
Constructor that takes a string containing muParserX expression.
Definition at line 45 of file muParserXInterface.hpp.
|
inline |
The copy constructor
MuparserX has a particular design, which obliges to define a special copy constructor The reson is that a muparser engine stores the address of the variables. So a normal copy would do a shallow copy, which is NOT what you want. Moreover, because of a poor design, you may loose the expression. That's why I keep a copy in the class as a string and a redefine in in the muparser engine.
| mpi | the muParserXInterface to be copied |
Definition at line 63 of file muParserXInterface.hpp.
|
inlinestatic |
Factory method to create an interface from a text file. Reads the first line of the file as the expression.
| filename | Path to the file containing the expression |
Definition at line 100 of file muParserXInterface.hpp.
|
inline |
Definition at line 141 of file muParserXInterface.hpp.
|
inline |
The copy assignment operator
MuparserX has a particular design, which obliges to define a special copy assignement
| mpi | the muParserXInterface to be copied The copy constructor |
Definition at line 79 of file muParserXInterface.hpp.
|
inline |
Sets the muparserX expression.
Beware, the input variables are indicated by x[]. example of a valid expression: sin(x[0])+x[1]*x[2]
Definition at line 134 of file muParserXInterface.hpp.