35 # include <cppad/cppad.hpp>
37 typedef CppAD::vector<ADdouble>
ADvector;
1938 virtual ADdouble constructADTape(std::map<int, int> *ADIdx,
ADvector *XAD);
2492 virtual double calculateFunction(
double *x);
2506 virtual ADdouble constructADTape(std::map<int, int> *ADIdx,
ADvector *XAD);
virtual std::string getTokenName()=0
virtual std::string getTokenName()
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
~OSnLMNodeMatrixTranspose()
default destructor.
The OSnLNodeDivide Class.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
OSnLMNode * copyNodeAndDescendants()
make a copy of this node and all its descendants
virtual double calculateFunction(double *x)
The implementation of the virtual functions.
The OSnLNodeAllDiff Class.
OSnLNode()
default constructor.
virtual double calculateFunction(double *x)
virtual std::string getTokenName()
~OSnLNodeE()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual OSnLMNode * cloneExprNode()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
bool includeDiagonal
A boolean to express whether the diagonal is to be part of the upper triangle or not.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
The OSnLMNode Class for nonlinear expressions involving matrices.
virtual ~OSnLNode()
default destructor.
~OSnLNodePI()
default destructor.
virtual std::string getTokenName()
OSnLNodeDivide()
default constructor.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)=0
OSnLNodeTimes()
default constructor.
OSnLMNodeDiagonalMatrixFromVector()
default constructor.
virtual OSnLMNode * cloneExprNode()
virtual double calculateFunction(double *x)
virtual std::vector< ExprNode * > postOrderOSnLNodeTraversal(std::vector< ExprNode * > *postfixVector)
virtual std::string getTokenName()
OSnLNodeAllDiff()
default constructor.
~OSnLNodeLn()
default destructor.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
OSnLMNodeMatrixTimes()
default constructor.
~OSnLNodeMatrixDeterminant()
default destructor.
virtual void getVariableIndexMap(std::map< int, int > *varIdx)
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)=0
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
OSnLMNodeMatrixScalarTimes()
default constructor.
unsigned int inumberOfChildren
inumberOfChildren is the number of OSnLNode child elements If this number is not fixed, e.g., for a sum node, it is temporarily set to 0
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
OSnLNodeExp()
default constructor.
std::vector< ExprNode * > getPostfixFromExpressionTree()
virtual double calculateFunction(double *x)
OSnLNodePlus()
default constructor.
OSnLNodeNegate()
default constructor.
virtual double calculateFunction(double *x)
The OSnLNodeVariable Class.
OSnLMNodeMatrixUpperTriangle()
default constructor.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
OSnLMNodeMatrixReference()
default constructor.
~OSnLMNodeMatrixInverse()
default destructor.
OSnLMNode * createExpressionTreeFromPostfix(std::vector< ExprNode * > nlNodeVec)
virtual std::string getTokenName()
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual OSnLMNode * cloneExprNode()
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
OSnLNodeE()
default constructor.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
virtual std::string getTokenName()
virtual void getVariableIndexMap(std::map< int, int > *varIdx)
virtual std::string getNonlinearExpressionInXML()
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
virtual std::string getNonlinearExpressionInXML()
OSnLNodeSin()
default constructor.
bool includeDiagonal
A boolean to express whether the diagonal is to be part of the upper triangle or not.
~OSnLNodeIf()
default destructor.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual double calculateFunction(double *x)
~OSnLNodeNumber()
default destructor.
OSnLNode * createExpressionTreeFromPostfix(std::vector< ExprNode * > nlNodeVec)
OSnLNodeProduct()
default constructor.
virtual OSnLNode * cloneExprNode()
~OSnLNodeVariable()
default destructor.
OSnLMNode()
default constructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
~OSnLMNodeMatrixDotTimes()
default destructor.
virtual std::string getTokenName()
virtual std::string getTokenName()
virtual OSnLMNode * cloneExprNode()
OSnLNodeCos()
default constructor.
int idx
The index of the matrix.
OSnLNodeSqrt()
default constructor.
virtual std::string getTokenNumber()
~OSnLNodeErf()
default destructor.
~OSnLMNodeMatrixPlus()
default destructor.
OSnLNodeMatrixDeterminant()
default constructor.
virtual std::string getTokenName()
OSnLMNodeMatrixProduct()
default constructor.
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual std::vector< ExprNode * > getPrefixFromExpressionTree()
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
~OSnLNodeSin()
default destructor.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
The OSnLNodeMatrixTrace Class.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual ExprNode * cloneExprNode()=0
The OSnLMNodeMatrixProduct Class.
virtual std::string getTokenName()
OSnLMNodeMatrixPlus()
default constructor.
OSnLNode * createExpressionTreeFromPrefix(std::vector< ExprNode * > nlNodeVec)
virtual std::string getTokenName()
~OSnLNodePlus()
default destructor.
virtual std::vector< ExprNode * > getPostfixFromExpressionTree()
double m_dFunctionValue
m_dFunctionValue holds the function value given the current variable values.
virtual std::string getNonlinearExpressionInXML()
virtual std::vector< ExprNode * > postOrderOSnLNodeTraversal(std::vector< ExprNode * > *postfixVector)
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
~OSnLMNodeMatrixTimes()
default destructor.
OSnLMNodeMatrixMinus()
default constructor.
OSnLMNodeMatrixNegate()
default constructor.
~OSnLNodeDivide()
default destructor.
unsigned int inumberOfMatrixChildren
inumberOfMatrixChildren is the number of OSnLMNode child elements If this number is not fixed...
OSnLNodeMax()
default constructor.
virtual OSnLMNode * cloneExprNode()
std::vector< ADdouble > ADvector
virtual OSnLMNode * cloneExprNode()
~OSnLNodeNegate()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
~OSnLNodeMatrixTrace()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
bool IsEqual(OSnLMNode *that)
A function to check for the equality of two objects.
The OSnLNodeMatrixTrace Class.
virtual std::vector< ExprNode * > preOrderOSnLNodeTraversal(std::vector< ExprNode * > *prefixVector)
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual std::string getTokenName()
~OSnLMNodeMatrixMinus()
default destructor.
std::string type
in the C++ type is real
virtual std::string getTokenName()
virtual std::string getTokenName()
OSnLNodeMin()
default constructor.
OSnLMNodeMatrixDiagonal()
default constructor.
~OSnLMNodeMatrixScalarTimes()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
double coef
coef is an option coefficient on the variable, the default value is 1.0
The next few nodes evaluate to a scalar even though one or more of its arguments are matrices...
OSnLMNodeMatrixSubmatrixAt()
default constructor.
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
~OSnLNodeAbs()
default destructor.
virtual std::string getTokenName()
~OSnLNodeMatrixToScalar()
default destructor.
virtual bool IsEqual(ExprNode *that)
A function to check for the equality of two objects.
int idx
idx is the index of the variable
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual std::string getTokenNumber()
virtual std::string getTokenName()
virtual OSnLMNode * cloneExprNode()
~OSnLNodeSquare()
default destructor.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual OSnLMNode * cloneExprNode()
virtual std::string getNonlinearExpressionInXML()
virtual std::string getTokenNumber()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
OSnLMNodeIdentityMatrix()
default constructor.
virtual OSnLMNode * cloneExprNode()
~OSnLMNodeMatrixProduct()
default destructor.
virtual std::vector< ExprNode * > getPrefixFromExpressionTree()
The OSnLNodeNegate Class.
~OSnLNodeProduct()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
OSnLMNode ** m_mMatrixChildren
m_mMatrixChildren holds all the matrix-valued operands, if any.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
~OSnLMNodeIdentityMatrix()
default destructor.
~OSnLNodeSqrt()
default destructor.
~OSnLNodeTimes()
default destructor.
~OSnLMNodeMatrixReference()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
OSnLNodeLn()
default constructor.
virtual OSnLNode * cloneExprNode()
~OSnLNodeMin()
default destructor.
virtual std::string getTokenName()
OSnLMNodeMatrixTranspose()
default constructor.
virtual std::string getTokenName()
std::vector< ExprNode * > postOrderOSnLNodeTraversal(std::vector< ExprNode * > *postfixVector)
virtual double calculateFunction(double *x)
The implementation of the virtual functions.
OSnLNodeSquare()
default constructor.
virtual double calculateFunction(double *x)
The implementation of the virtual functions.
virtual std::string getNonlinearExpressionInXML()
virtual double calculateFunction(double *x)
OSnLNodeVariable()
default constructor.
virtual std::string getTokenName()
virtual OSnLMNode * cloneExprNode()
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
virtual std::string getTokenName()
OSnLNodeMatrixTrace()
default constructor.
virtual double calculateFunction(double *x)
virtual OSnLMNode * cloneExprNode()
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
std::string id
later, e.g.
~OSnLNodeCos()
default destructor.
virtual OSnLMNode * cloneExprNode()
virtual std::string getTokenName()
OSnLMNode * createExpressionTreeFromPrefix(std::vector< ExprNode * > nlNodeVec)
OSnLNodeIf()
default constructor.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
The OSnLNodeNumber Class.
virtual double calculateFunction(double *x)
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual std::string getTokenNumber()
virtual std::string getNonlinearExpressionInXML()
virtual std::string getTokenNumber()
virtual OSnLMNode * cloneExprNode()
A generic class from which we derive both OSnLNode and OSnLMNode.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
~OSnLMNodeMatrixUpperTriangle()
default destructor.
~OSnLMNodeDiagonalMatrixFromVector()
default destructor.
OSnLNodeErf()
default constructor.
virtual std::vector< ExprNode * > preOrderOSnLNodeTraversal(std::vector< ExprNode * > *prefixVector)
~OSnLNodeAllDiff()
default destructor.
The OSnLNodeSquare Class.
OSnLMNodeMatrixSum()
default constructor.
OSnLNode * copyNodeAndDescendants()
make a copy of this node and all its descendants
ExprNode()
default constructor.
virtual std::string getNonlinearExpressionInXML()
virtual double calculateFunction(double *x)
~OSnLNodeMax()
default destructor.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
virtual ~OSnLMNode()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
std::vector< ExprNode * > preOrderOSnLNodeTraversal(std::vector< ExprNode * > *prefixVector)
virtual double calculateFunction(double *x)
virtual double calculateFunction(double *x)
virtual double calculateFunction(double *x)
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual std::vector< ExprNode * > getPostfixFromExpressionTree()
OSnLMNodeMatrixInverse()
default constructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual std::string getTokenNumber()
virtual std::string getTokenName()
virtual ~ExprNode()
default destructor.
virtual double calculateFunction(double *x)
OSnLNodePI()
default constructor.
~OSnLMNodeMatrixLowerTriangle()
default destructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
int inodeInt
inodeInt is the unique integer assigned to the OSnLNode or OSnLMNode in OSParameters.h.
OSnLNodeSum()
default constructor.
OSnLNode ** m_mChildren
m_mChildren holds all the operands, that is, nodes that the current node operates on...
OSnLMNodeMatrixDotTimes()
default constructor.
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual double calculateFunction(double *x)
virtual std::string getTokenName()
OSnLNodeMatrixToScalar()
default constructor.
~OSnLMNodeMatrixSubmatrixAt()
default destructor.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
virtual std::string getNonlinearExpressionInXML()
virtual OSnLMNode * cloneExprNode()
The implementation of the virtual functions.
~OSnLNodePower()
default destructor.
a data structure to represent a matrix object (derived from MatrixType)
~OSnLMNodeMatrixSum()
default destructor.
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
ADdouble m_ADTape
m_ADTape stores the expression tree for the this OSnLNode as an ADdouble.
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
std::vector< ExprNode * > getPrefixFromExpressionTree()
OSnLNodeAbs()
default constructor.
virtual std::string getTokenName()
virtual double calculateFunction(double *x)
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
~OSnLNodeMinus()
default destructor.
virtual std::string getTokenName()
~OSnLNodeExp()
default destructor.
OSnLNodePower()
default constructor.
OSnLNodeNumber()
default constructor.
virtual OSnLMNode * cloneExprNode()
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
virtual OSnLNode * cloneExprNode()
~OSnLNodeSum()
default destructor.
virtual OSnLMNode * cloneExprNode()
OSnLNodeMinus()
default constructor.
~OSnLMNodeMatrixDiagonal()
default destructor.
virtual double calculateFunction(double *x)
virtual std::string getTokenName()
virtual ADdouble constructADTape(std::map< int, int > *ADIdx, ADvector *XAD)
The implementation of the virtual functions.
OSnLMNodeMatrixLowerTriangle()
default constructor.
virtual OSnLMNode * cloneExprNode()
virtual std::string getTokenName()
The OSnLNodeProduct Class.
virtual std::string getTokenName()
virtual OSnLNode * cloneExprNode()
The implementation of the virtual functions.
bool IsEqual(OSnLNode *that)
A function to check for the equality of two objects.
virtual std::string getTokenName()
double value
value is the value of the number
The OSnLNode Class for nonlinear expressions.
int inodeType
inodeType essentially tracks whether the number of children are known or not.
~OSnLMNodeMatrixNegate()
default destructor.