Used to hold the instance in memory. More...
#include <OSExpressionTree.h>
Public Member Functions | |
OSExpressionTree () | |
default constructor. | |
~OSExpressionTree () | |
default destructor. | |
bool | IsEqual (OSExpressionTree *that) |
A function to check for the equality of two objects. | |
double | calculateFunction (double *x, bool new_x) |
Calculate the expression tree function value given the current variable values using the calculateFunction method of OSnLNode. | |
std::vector< OSnLNode * > | getPrefixFromExpressionTree () |
Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in prefix format. | |
std::vector< OSnLNode * > | getPostfixFromExpressionTree () |
Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in postfix format. | |
std::map< int, int > * | getVariableIndiciesMap () |
Retrieve a map of the indices of the variables that are in the expression tree. | |
std::map< int, int > * | getVariableIndicesMap () |
Retrieve a map of the indices of the variables that are in the expression tree. | |
Public Attributes | |
OSnLNode * | m_treeRoot |
m_treeRoot holds the root node (of OSnLNode type) of the expression tree. | |
std::map< int, int > * | mapVarIdx |
m_mvarIdx is a map used by constructADTape(std::map<int, int> *varIdx, AD::vector< AD<double> > *XAD) to generate the infix expression for AD -- the key is idx a variable number, the value of the map is the corresponding variable count in sparse representation | |
bool | m_bIndexMapGenerated |
m_bIndexMapGenerated is set to true if getVariableIndicesMap() has been called | |
bool | bADMustReTape |
is true if a AD Expresion Tree has an expression that can change depending on the value of the input, e.g. | |
bool | bDestroyNlNodes |
m_bDestroyNlNodes if the destructor deletes the OSnLNodes in the Expression tree | |
Private Attributes | |
double | m_dTreeRootValue |
m_dTreeRootValue is the function value of the root node |
Used to hold the instance in memory.
Definition at line 33 of file OSExpressionTree.h.
OSExpressionTree::OSExpressionTree | ( | ) |
default constructor.
Definition at line 23 of file OSExpressionTree.cpp.
OSExpressionTree::~OSExpressionTree | ( | ) |
default destructor.
Definition at line 33 of file OSExpressionTree.cpp.
bool OSExpressionTree::IsEqual | ( | OSExpressionTree * | that | ) |
A function to check for the equality of two objects.
Definition at line 99 of file OSExpressionTree.cpp.
double OSExpressionTree::calculateFunction | ( | double * | x, | |
bool | new_x | |||
) |
Calculate the expression tree function value given the current variable values using the calculateFunction method of OSnLNode.
If the function has been calculated, the method will retrieve it.
x | holds the values of the variables in a double array. | |
new_x | is false if any evaluation method was previously called for the current x |
Definition at line 64 of file OSExpressionTree.cpp.
std::vector< OSnLNode * > OSExpressionTree::getPrefixFromExpressionTree | ( | ) |
Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in prefix format.
Definition at line 57 of file OSExpressionTree.cpp.
std::vector< OSnLNode * > OSExpressionTree::getPostfixFromExpressionTree | ( | ) |
Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in postfix format.
Definition at line 51 of file OSExpressionTree.cpp.
std::map< int, int > * OSExpressionTree::getVariableIndiciesMap | ( | ) |
Retrieve a map of the indices of the variables that are in the expression tree.
Definition at line 78 of file OSExpressionTree.cpp.
std::map< int, int > * OSExpressionTree::getVariableIndicesMap | ( | ) |
Retrieve a map of the indices of the variables that are in the expression tree.
Definition at line 83 of file OSExpressionTree.cpp.
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
Definition at line 41 of file OSExpressionTree.h.
std::map<int, int>* OSExpressionTree::mapVarIdx |
m_mvarIdx is a map used by constructADTape(std::map<int, int> *varIdx, AD::vector< AD<double> > *XAD) to generate the infix expression for AD -- the key is idx a variable number, the value of the map is the corresponding variable count in sparse representation
Definition at line 101 of file OSExpressionTree.h.
m_bIndexMapGenerated is set to true if getVariableIndicesMap() has been called
Definition at line 128 of file OSExpressionTree.h.
is true if a AD Expresion Tree has an expression that can change depending on the value of the input, e.g.
an if statement -- false by default
Definition at line 134 of file OSExpressionTree.h.
m_bDestroyNlNodes if the destructor deletes the OSnLNodes in the Expression tree
Definition at line 139 of file OSExpressionTree.h.
double OSExpressionTree::m_dTreeRootValue [private] |
m_dTreeRootValue is the function value of the root node
Definition at line 148 of file OSExpressionTree.h.