KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
PROJECT_NS::Expression< T > Class Template Reference

A class representing a mathematical expression. More...

#include <Expression.h>

Collaboration diagram for PROJECT_NS::Expression< T >:
Collaboration graph

Public Member Functions

evaluate (T *data)
 Evaluate the expression with given variable values.
 

Static Public Member Functions

static std::vector< Expression< T > > & getExpressions ()
 Get the list of registered expressions.
 
static int registerExpression (const std::string &expression, const std::vector< std::string > &variables)
 Register a new mathematical expression.
 

Private Member Functions

 Expression (const std::string &expressionStr, const std::vector< std::string > &varsStr)
 Private constructor to initialize the expression.
 
_evaluate (T *data)
 

Private Attributes

std::string expressionString
 The mathematical expression string.
 
std::string variablesString
 List of variables in the expression.
 
FunctionParserBase< T > parser
 The parser for the expression.
 

Detailed Description

template<typename T>
class PROJECT_NS::Expression< T >

A class representing a mathematical expression.

This class allows registration, storage, and evaluation of mathematical expressions.

Template Parameters
TThe data type of the expression (e.g., float, double, complex)

Definition at line 50 of file Expression.h.

Constructor & Destructor Documentation

◆ Expression()

template<typename T >
PROJECT_NS::Expression< T >::Expression ( const std::string & expressionStr,
const std::vector< std::string > & varsStr )
inlineprivate

Private constructor to initialize the expression.

Parameters
expressionStrThe mathematical expression string.
varsStrThe list of variables in the expression.

Definition at line 127 of file Expression.h.

References PROJECT_NS::Expression< T >::expressionString, PROJECT_NS::Expression< T >::parser, and PROJECT_NS::Expression< T >::variablesString.

Member Function Documentation

◆ _evaluate()

template<typename T >
T PROJECT_NS::Expression< T >::_evaluate ( T * data)
inlineprivate

Definition at line 137 of file Expression.h.

References PROJECT_NS::Expression< T >::parser.

Referenced by PROJECT_NS::Expression< T >::evaluate().

Here is the caller graph for this function:

◆ evaluate()

template<typename T >
T PROJECT_NS::Expression< T >::evaluate ( T * data)
inline

Evaluate the expression with given variable values.

Parameters
dataAn array containing values of variables.
Returns
The result of the expression evaluation.

Definition at line 85 of file Expression.h.

References PROJECT_NS::Expression< T >::_evaluate().

Referenced by PROJECT_NS::einsum_fun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExpressions()

template<typename T >
static std::vector< Expression< T > > & PROJECT_NS::Expression< T >::getExpressions ( )
inlinestatic

Get the list of registered expressions.

Returns
A reference to the list of registered expressions.

Definition at line 57 of file Expression.h.

Referenced by PROJECT_NS::RuleEvaluator::calculateResult(), and PROJECT_NS::Expression< T >::registerExpression().

Here is the caller graph for this function:

◆ registerExpression()

template<typename T >
static int PROJECT_NS::Expression< T >::registerExpression ( const std::string & expression,
const std::vector< std::string > & variables )
inlinestatic

Register a new mathematical expression.

Parameters
expressionThe mathematical expression string.
variablesThe list of variables in the expression.
Returns
The index of the registered expression.

Definition at line 69 of file Expression.h.

References PROJECT_NS::Expression< T >::getExpressions().

Referenced by PROJECT_NS::RuleEvaluator::RuleEvaluator().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ expressionString

template<typename T >
std::string PROJECT_NS::Expression< T >::expressionString
private

The mathematical expression string.

Definition at line 117 of file Expression.h.

Referenced by PROJECT_NS::Expression< T >::Expression().

◆ parser

template<typename T >
FunctionParserBase<T> PROJECT_NS::Expression< T >::parser
private

The parser for the expression.

Definition at line 119 of file Expression.h.

Referenced by PROJECT_NS::Expression< T >::_evaluate(), and PROJECT_NS::Expression< T >::Expression().

◆ variablesString

template<typename T >
std::string PROJECT_NS::Expression< T >::variablesString
private

List of variables in the expression.

Definition at line 118 of file Expression.h.

Referenced by PROJECT_NS::Expression< T >::Expression().


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