Organizes the evaluation of the function tree. More...
#include <function_evaluation_tree.hpp>
Public Member Functions | |
virtual returnValue | AD_backward (double *seed, double *df) |
virtual returnValue | AD_backward (int number, double *seed, double *df) |
virtual returnValue | AD_backward2 (int number, double *seed1, double *seed2, double *df, double *ddf) |
virtual returnValue | AD_forward (double *x, double *seed, double *f, double *df) |
virtual returnValue | AD_forward (int number, double *seed, double *df) |
virtual returnValue | AD_forward (int number, double *x, double *seed, double *f, double *df) |
virtual returnValue | AD_forward2 (int number, double *seed1, double *seed2, double *df, double *ddf) |
returnValue | C_print (std::ostream &stream=std::cout, const char *fcnName="ACADOfcn", const char *realString="double") const |
virtual returnValue | clearBuffer () |
FunctionEvaluationTree * | differentiate (int index) |
virtual returnValue | evaluate (double *x, double *result) |
template<typename T > | |
returnValue | evaluate (Tmatrix< T > *x, Tmatrix< T > *result) |
virtual returnValue | evaluate (double *x, double *result, PrintLevel printL) |
virtual returnValue | evaluate (int number, double *x, double *result) |
returnValue | exportCode (std::ostream &stream=std::cout, const char *fcnName="ACADOfcn", const char *realString="double", uint _numX=0, uint _numXA=0, uint _numU=0, uint _numP=0, uint _numDX=0, uint _numOD=0, bool allocateMemory=true, bool staticMemory=false) const |
returnValue | exportForwardDeclarations (std::ostream &stream=std::cout, const char *fcnName="ACADOfcn", const char *realString="double") const |
FunctionEvaluationTree () | |
FunctionEvaluationTree (const FunctionEvaluationTree &arg) | |
virtual CurvatureType | getCurvature () |
virtual int | getDim () const |
virtual Operator * | getExpression (uint componentIdx) const |
virtual returnValue | getExpression (Expression &expression) const |
std::string | getGlobalExportVariableName () const |
unsigned | getGlobalExportVariableSize () const |
virtual MonotonicityType | getMonotonicity () |
virtual int | getN () const |
virtual int | getNDX () const |
virtual int | getNOD () const |
virtual int | getNP () const |
virtual int | getNPI () const |
virtual int | getNT () const |
virtual int | getNU () const |
virtual int | getNUI () const |
virtual int | getNumberOfVariables () const |
virtual int | getNW () const |
virtual int | getNX () const |
virtual int | getNXA () const |
virtual int | index (VariableType variableType_, int index_) const |
virtual BooleanType | isDependingOn (const Expression &variable) |
virtual BooleanType | isLinearIn (const Expression &variable) |
virtual NeutralElement | isOneOrZero () |
virtual BooleanType | isPolynomialIn (const Expression &variable) |
virtual BooleanType | isRationalIn (const Expression &variable) |
virtual BooleanType | isSymbolic () const |
virtual returnValue | makeImplicit () |
virtual returnValue | makeImplicit (int dim_) |
virtual returnValue | operator<< (const Expression &arg) |
FunctionEvaluationTree & | operator= (const FunctionEvaluationTree &arg) |
virtual double | scale (VariableType variableType_, int index_) const |
returnValue | setGlobalExportVariableName (const std::string &_name) |
virtual returnValue | setScale (double *scale_) |
virtual FunctionEvaluationTree | substitute (VariableType variableType_, int index_, double sub_) |
virtual | ~FunctionEvaluationTree () |
Protected Attributes | |
int | dim |
Operator ** | f |
std::string | globalExportVariableName |
SymbolicIndexList * | indexList |
int * | lhs_comp |
int | n |
Expression | safeCopy |
Operator ** | sub |
Organizes the evaluation of the function tree.
The class FunctionEvaluationTree is designed to organize the evaluation of tree structured expressions.
Definition at line 53 of file function_evaluation_tree.hpp.
Default constructor.
Definition at line 48 of file function_evaluation_tree.cpp.
Copy constructor (deep copy).
Definition at line 60 of file function_evaluation_tree.cpp.
FunctionEvaluationTree::~FunctionEvaluationTree | ( | ) | [virtual] |
Destructor.
Definition at line 100 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_backward | ( | double * | seed, |
double * | df | ||
) | [virtual] |
Automatic Differentiation in backward mode.
seed | the seed |
df | the derivative of the expression |
Definition at line 772 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_backward | ( | int | number, |
double * | seed, | ||
double * | df | ||
) | [virtual] |
Automatic Differentiation in backward mode based on
buffered values
number | the buffer position |
seed | the seed |
df | the derivative of the expression |
Definition at line 793 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_backward2 | ( | int | number, |
double * | seed1, | ||
double * | seed2, | ||
double * | df, | ||
double * | ddf | ||
) | [virtual] |
Automatic Differentiation in backward mode for 2nd order
derivatives based on buffered values.
number | the buffer position |
seed1 | the seed1 |
seed2 | the seed2 |
df | the 1st derivative of the expression |
ddf | the 2nd derivative of the expression |
Definition at line 830 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_forward | ( | double * | x, |
double * | seed, | ||
double * | f, | ||
double * | df | ||
) | [virtual] |
Automatic Differentiation in forward mode.
x | The evaluation point x |
seed | the seed |
f | the value of the expression at x |
df | the derivative of the expression |
Definition at line 719 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_forward | ( | int | number, |
double * | seed, | ||
double * | df | ||
) | [virtual] |
Automatic Differentiation in forward mode.
This function uses the intermediate
results from a buffer
number | storage position |
seed | the seed |
df | the derivative of the expression |
Definition at line 756 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_forward | ( | int | number, |
double * | x, | ||
double * | seed, | ||
double * | f, | ||
double * | df | ||
) | [virtual] |
Automatic Differentiation in forward mode.
This function stores the intermediate
results in a buffer (needed for 2nd order automatic
differentiation in backward mode)
number | storage position |
x | The evaluation point x |
seed | the seed |
f | the value of the expression at x |
df | the derivative of the expression |
Definition at line 738 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::AD_forward2 | ( | int | number, |
double * | seed1, | ||
double * | seed2, | ||
double * | df, | ||
double * | ddf | ||
) | [virtual] |
Automatic Differentiation in forward mode for
2nd derivatives.
This function uses intermediate
results from a buffer.
number | the buffer position |
seed1 | the seed |
seed2 | the seed for the first derivative |
df | the derivative of the expression |
ddf | the 2nd derivative of the expression |
Definition at line 811 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::C_print | ( | std::ostream & | stream = std::cout , |
const char * | fcnName = "ACADOfcn" , |
||
const char * | realString = "double" |
||
) | const |
Prints the expression as C-code into a file.
file | The file to which the expression should be printed. |
fcnName | The name of the generated function (default: "ACADOfcn"). |
realString |
Definition at line 854 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::clearBuffer | ( | ) | [virtual] |
Clears the buffer and resets the buffer size
to 1.
Definition at line 1016 of file function_evaluation_tree.cpp.
FunctionEvaluationTree * FunctionEvaluationTree::differentiate | ( | int | index | ) |
Returns the derivative of the expression with respect
to the variable var(index).
index | diff. index |
Definition at line 301 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::evaluate | ( | double * | x, |
double * | result | ||
) | [virtual] |
Evaluates the expression
x | the input variable x |
result | the result |
Definition at line 238 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::evaluate | ( | Tmatrix< T > * | x, |
Tmatrix< T > * | result | ||
) |
Evaluates the expression
Definition at line 488 of file function_evaluation_tree.hpp.
returnValue FunctionEvaluationTree::evaluate | ( | double * | x, |
double * | result, | ||
PrintLevel | printL | ||
) | [virtual] |
Evaluates the expression and also prints
the intermediate results with a specified
print level.
x | the input variable x |
result | the result |
printL | the print level |
Definition at line 255 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::evaluate | ( | int | number, |
double * | x, | ||
double * | result | ||
) | [virtual] |
Evaluates the expression and stores the intermediate
results in a buffer (needed for automatic differentiation
in backward mode)
number | storage position |
x | the input variable x |
result | the result |
Definition at line 284 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::exportCode | ( | std::ostream & | stream = std::cout , |
const char * | fcnName = "ACADOfcn" , |
||
const char * | realString = "double" , |
||
uint | _numX = 0 , |
||
uint | _numXA = 0 , |
||
uint | _numU = 0 , |
||
uint | _numP = 0 , |
||
uint | _numDX = 0 , |
||
uint | _numOD = 0 , |
||
bool | allocateMemory = true , |
||
bool | staticMemory = false |
||
) | const |
Definition at line 887 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::exportForwardDeclarations | ( | std::ostream & | stream = std::cout , |
const char * | fcnName = "ACADOfcn" , |
||
const char * | realString = "double" |
||
) | const |
Definition at line 868 of file function_evaluation_tree.cpp.
CurvatureType FunctionEvaluationTree::getCurvature | ( | ) | [virtual] |
Returns the curvature of the expression
Definition at line 684 of file function_evaluation_tree.cpp.
virtual int FunctionEvaluationTree::getDim | ( | ) | const [virtual] |
Returns the dimension of the symbolic expression
Operator * FunctionEvaluationTree::getExpression | ( | uint | componentIdx | ) | const [virtual] |
Returns the symbolic expression of the given component of the function.
Definition at line 1133 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::getExpression | ( | Expression & | expression | ) | const [virtual] |
Definition at line 192 of file function_evaluation_tree.cpp.
std::string FunctionEvaluationTree::getGlobalExportVariableName | ( | ) | const |
Definition at line 1171 of file function_evaluation_tree.cpp.
unsigned FunctionEvaluationTree::getGlobalExportVariableSize | ( | ) | const |
Definition at line 1176 of file function_evaluation_tree.cpp.
MonotonicityType FunctionEvaluationTree::getMonotonicity | ( | ) | [virtual] |
Returns the monotonicity of the expression.
Definition at line 649 of file function_evaluation_tree.cpp.
virtual int FunctionEvaluationTree::getN | ( | ) | const [virtual] |
Returns the number of intermediate expressions that have
been detected in the symbolic expression.
int FunctionEvaluationTree::getNDX | ( | ) | const [virtual] |
Returns the number of differential states derivatives
Definition at line 1076 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNOD | ( | ) | const [virtual] |
Return number of "online data" objects.
Definition at line 1111 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNP | ( | ) | const [virtual] |
Returns the number of parameters
Definition at line 1091 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNPI | ( | ) | const [virtual] |
Returns the number of integer parameters
Definition at line 1096 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNT | ( | ) | const [virtual] |
Returns the number of time variables
Definition at line 1106 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNU | ( | ) | const [virtual] |
Returns the number of controls
Definition at line 1081 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNUI | ( | ) | const [virtual] |
Returns the number of integer controls
Definition at line 1086 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNumberOfVariables | ( | ) | const [virtual] |
Returns the variable counter.
Definition at line 1127 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNW | ( | ) | const [virtual] |
Returns the number of disturbances
Definition at line 1101 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNX | ( | ) | const [virtual] |
Returns the number of differential states
Definition at line 1066 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::getNXA | ( | ) | const [virtual] |
Returns the number of algebraic states
Definition at line 1071 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::index | ( | VariableType | variableType_, |
int | index_ | ||
) | const [virtual] |
Returns the index of the variable with specified type and
component.
Definition at line 1116 of file function_evaluation_tree.cpp.
BooleanType FunctionEvaluationTree::isDependingOn | ( | const Expression & | variable | ) | [virtual] |
Checks whether the symbolic expression is depending on
a specified variable.
Definition at line 436 of file function_evaluation_tree.cpp.
BooleanType FunctionEvaluationTree::isLinearIn | ( | const Expression & | variable | ) | [virtual] |
Checks whether the symbolic expression is linear in
a specified variable.
Definition at line 489 of file function_evaluation_tree.cpp.
NeutralElement FunctionEvaluationTree::isOneOrZero | ( | ) | [virtual] |
Checks whether the expression is zero or one
Definition at line 398 of file function_evaluation_tree.cpp.
BooleanType FunctionEvaluationTree::isPolynomialIn | ( | const Expression & | variable | ) | [virtual] |
Checks whether the expression is polynomial in
a variable.
Definition at line 542 of file function_evaluation_tree.cpp.
BooleanType FunctionEvaluationTree::isRationalIn | ( | const Expression & | variable | ) | [virtual] |
Checks whether the expression is rational in
the variable var(index)
Definition at line 596 of file function_evaluation_tree.cpp.
BooleanType FunctionEvaluationTree::isSymbolic | ( | ) | const [virtual] |
Returns whether the function is symbolic or not. If BT_TRUE
is returned, automatic differentiation will be used by
default.
Definition at line 1143 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::makeImplicit | ( | ) | [virtual] |
Make the symbolic expression implicit. This functionality
makes only sense for Differential Equation and should in
general not be used for anything else. (Although it is
public here.)
Definition at line 1038 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::makeImplicit | ( | int | dim_ | ) | [virtual] |
Definition at line 1044 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::operator<< | ( | const Expression & | arg | ) | [virtual] |
Loading Expressions (deep copy).
Definition at line 199 of file function_evaluation_tree.cpp.
FunctionEvaluationTree & FunctionEvaluationTree::operator= | ( | const FunctionEvaluationTree & | arg | ) |
Assignment operator (deep copy).
Definition at line 128 of file function_evaluation_tree.cpp.
double FunctionEvaluationTree::scale | ( | VariableType | variableType_, |
int | index_ | ||
) | const [virtual] |
Returns the scale of a given variable.
Definition at line 1121 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::setGlobalExportVariableName | ( | const std::string & | _name | ) |
Definition at line 1161 of file function_evaluation_tree.cpp.
returnValue FunctionEvaluationTree::setScale | ( | double * | scale_ | ) | [virtual] |
Defines scalings for the variables.
Definition at line 1156 of file function_evaluation_tree.cpp.
FunctionEvaluationTree FunctionEvaluationTree::substitute | ( | VariableType | variableType_, |
int | index_, | ||
double | sub_ | ||
) | [virtual] |
Substitutes var(index) with the double sub.
index_ | subst. index |
sub_ | the substitution |
Definition at line 309 of file function_evaluation_tree.cpp.
int FunctionEvaluationTree::dim [protected] |
The dimension of the function.
Definition at line 478 of file function_evaluation_tree.hpp.
Operator** FunctionEvaluationTree::f [protected] |
The right-hand side expressions
Definition at line 474 of file function_evaluation_tree.hpp.
std::string FunctionEvaluationTree::globalExportVariableName [protected] |
Name of the variable that holds intermediate expressions.
Definition at line 484 of file function_evaluation_tree.hpp.
SymbolicIndexList* FunctionEvaluationTree::indexList [protected] |
Definition at line 477 of file function_evaluation_tree.hpp.
int* FunctionEvaluationTree::lhs_comp [protected] |
The components of the intermediate states
Definition at line 476 of file function_evaluation_tree.hpp.
int FunctionEvaluationTree::n [protected] |
The number of Intermediate expressions
Definition at line 479 of file function_evaluation_tree.hpp.
Expression FunctionEvaluationTree::safeCopy [protected] |
Definition at line 481 of file function_evaluation_tree.hpp.
Operator** FunctionEvaluationTree::sub [protected] |
The intermediate expressions
Definition at line 475 of file function_evaluation_tree.hpp.