Abstract base class for all scalar-valued binary operators within the symbolic operators family. More...
#include <binary_operator.hpp>
Protected Member Functions | |
void | copy (const BinaryOperator &arg) |
void | deleteAll () |
Protected Member Functions inherited from Operator | |
returnValue | ADsymCommon (Operator *a, TreeProjection &da, TreeProjection &dda, int dim, VariableType *varType, int *component, Operator *l, Operator **S, int dimS, Operator **dfS, Operator **ldf, Operator **H, int &nNewLIS, TreeProjection ***newLIS, int &nNewSIS, TreeProjection ***newSIS, int &nNewHIS, TreeProjection ***newHIS) |
returnValue | ADsymCommon2 (Operator *a, Operator *b, TreeProjection &dx, TreeProjection &dy, TreeProjection &dxx, TreeProjection &dxy, TreeProjection &dyy, int dim, VariableType *varType, int *component, Operator *l, Operator **S, int dimS, Operator **dfS, Operator **ldf, Operator **H, int &nNewLIS, TreeProjection ***newLIS, int &nNewSIS, TreeProjection ***newSIS, int &nNewHIS, TreeProjection ***newHIS) |
virtual TreeProjection * | convert2TreeProjection (Operator *a) const |
Protected Attributes | |
Operator * | argument1 |
double * | argument1_result |
Operator * | argument2 |
double * | argument2_result |
int | bufferSize |
CurvatureType | curvature |
Operator * | dargument1 |
double * | dargument1_result |
Operator * | dargument2 |
double * | dargument2_result |
MonotonicityType | monotonicity |
Protected Attributes inherited from Operator | |
BooleanType | initialized |
Friends | |
class | Power_Int |
Additional Inherited Members | |
Public Attributes inherited from SmoothOperator | |
int | nCount |
Public Attributes inherited from Operator | |
int | nCount |
Abstract base class for all scalar-valued binary operators within the symbolic operators family.
The class BinaryOperator serves as a base class all scalar-valued binary operators within the symbolic operators family.
Definition at line 56 of file binary_operator.hpp.
BEGIN_NAMESPACE_ACADO BinaryOperator::BinaryOperator | ( | ) |
Default constructor.
Definition at line 42 of file binary_operator.cpp.
Default constructor.
Definition at line 47 of file binary_operator.cpp.
BinaryOperator::BinaryOperator | ( | const BinaryOperator & | arg | ) |
Copy constructor (deep copy).
Definition at line 65 of file binary_operator.cpp.
|
virtual |
Default destructor.
Definition at line 73 of file binary_operator.cpp.
|
pure virtual |
Automatic Differentiation in backward mode on the symbolic
level. This function generates an expression for a
backward derivative
dim | number of directions |
varType | the variable types |
component | and their components |
seed | the backward seed |
df | the result |
nNewIS | the number of new IS |
newIS | the new IS-pointer |
Implements SmoothOperator.
Implemented in Power, Product, Quotient, Subtraction, and Addition.
|
pure virtual |
Automatic Differentiation in backward mode based on
buffered values
number | the buffer position |
seed | the seed |
df | the derivative of the expression |
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Power, and Quotient.
|
pure 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 |
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Power, and Quotient.
|
pure virtual |
Automatic Differentiation in forward mode on the symbolic
level. This function generates an expression for a
forward derivative
dim | dimension of the seed |
varType | the variable types |
component | and their components |
seed | the forward seed |
nNewIS | the number of new IS |
newIS | the new IS-pointer |
Implements SmoothOperator.
Implemented in Power, Product, Quotient, Subtraction, and Addition.
|
pure 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 |
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Power, and Quotient.
|
pure 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 |
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Power, and Quotient.
|
pure 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 |
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Power, and Quotient.
|
pure virtual |
Automatic Differentiation in symmetric mode on the symbolic
level. This function generates an expression for a
second order derivative.
dim | number of directions |
varType | the variable types |
component | and their components |
l | the backward seed |
S | forward seed matrix |
dimS | dimension of forward seed |
dfS | first order foward result |
ldf | first order backward result |
H | upper trianglular part of the Hessian |
nNewLIS | the number of newLIS |
newLIS | the new LIS-pointer |
nNewSIS | the number of newSIS |
newSIS | the new SIS-pointer |
nNewHIS | the number of newHIS |
newHIS | the new HIS-pointer |
Implements SmoothOperator.
Implemented in Power, Product, Subtraction, Addition, and Quotient.
|
virtual |
Clears the buffer and resets the buffer size
to 1.
Implements SmoothOperator.
Definition at line 129 of file binary_operator.cpp.
|
pure virtual |
Provides a deep copy of the expression.
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Quotient, and Power.
|
protected |
Definition at line 191 of file binary_operator.cpp.
|
protected |
Definition at line 231 of file binary_operator.cpp.
|
pure virtual |
Returns the derivative of the expression with respect
to the variable var(index).
index | diff. index |
Implements SmoothOperator.
Implemented in Power, Product, Quotient, Subtraction, and Addition.
|
virtual |
Enumerates all variables based on a common
IndexList.
Implements SmoothOperator.
Definition at line 144 of file binary_operator.cpp.
|
pure 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 |
Implements SmoothOperator.
Implemented in Power, Product, Quotient, Subtraction, and Addition.
|
pure virtual |
Evaluates the expression (templated version)
Implements SmoothOperator.
Implemented in Power, Product, Quotient, Subtraction, and Addition.
|
pure virtual |
Returns the curvature of the expression
Implements SmoothOperator.
Implemented in Power, Addition, Product, Subtraction, and Quotient.
|
pure virtual |
Returns the monotonicity of the expression.
Implements SmoothOperator.
Implemented in Power, Addition, Product, Subtraction, and Quotient.
|
pure virtual |
Asks the expression for its name.
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Quotient, and Power.
|
virtual |
Reimplemented from Operator.
Reimplemented in Quotient, and Power.
Definition at line 260 of file binary_operator.cpp.
|
virtual |
Asks the expression whether it is depending on a certian type of
variable.
Implements SmoothOperator.
Definition at line 91 of file binary_operator.cpp.
|
virtual |
Checks whether the expression is depending on a variable
dim | number of directions |
varType | the variable types |
component | and their components |
implicit_dep | implicit dependencies |
Implements SmoothOperator.
Definition at line 101 of file binary_operator.cpp.
|
pure virtual |
Checks whether the expression is linear in
(or not depending on) a variable
dim | number of directions |
varType | the variable types |
component | and their components |
implicit_dep | implicit dependencies |
Implements SmoothOperator.
Implemented in Power, Product, Subtraction, Addition, and Quotient.
|
virtual |
Checks whether the expression is zero or one
Implements SmoothOperator.
Definition at line 89 of file binary_operator.cpp.
|
pure virtual |
Checks whether the expression is polynomial in
the specified variables
dim | number of directions |
varType | the variable types |
component | and their components |
implicit_dep | implicit dependencies |
Implements SmoothOperator.
Implemented in Power, Product, Subtraction, Addition, and Quotient.
|
pure virtual |
Checks whether the expression is rational in
the specified variables
dim | number of directions |
varType | the variable types |
component | and their components |
implicit_dep | implicit dependencies |
Implements SmoothOperator.
Implemented in Power, Product, Subtraction, Addition, and Quotient.
|
virtual |
Asks whether all elements are purely symbolic.
Implements SmoothOperator.
Definition at line 176 of file binary_operator.cpp.
|
virtual |
Asks the expression whether it is a variable.
Implements SmoothOperator.
Definition at line 156 of file binary_operator.cpp.
|
virtual |
The function loadIndices passes an IndexList through
the whole expression tree. Whenever a variable gets the
IndexList it tries to make an entry. However if a
variable recognices that it has already been added
before it will not be allowed to make a second entry.
Note that all variables, in paticular the intermediate
states, will keep in mind whether they were allowed
to make an entry or not. This guarantees that
intermediate states are never evaluated twice if they
occur at several knots of the tree.
THIS FUNCTION IS FOR INTERNAL USE ONLY.
PLEASE CALL THIS FUNTION AT MOST ONES FOR AN EXPRESSION
AS A KIND OF INIT ROUTINE.
indexList | The index list to be filled with entries |
Implements SmoothOperator.
Definition at line 162 of file binary_operator.cpp.
BinaryOperator & BinaryOperator::operator= | ( | const BinaryOperator & | arg | ) |
Assignment Operator (deep copy).
Definition at line 79 of file binary_operator.cpp.
|
pure virtual |
Prints the expression into a stream.
Implements SmoothOperator.
Implemented in Addition, Product, Subtraction, Power, and Quotient.
|
virtual |
Overwrites the curvature of the expression.
(For the case that the curvature is explicitly known)
Implements SmoothOperator.
Definition at line 122 of file binary_operator.cpp.
|
virtual |
Overwrites the monotonicity of the expression.
(For the case that the monotonicity is explicitly known)
Implements SmoothOperator.
Definition at line 115 of file binary_operator.cpp.
|
virtual |
Sets the name of the variable that is used for code export.
Reimplemented from Operator.
Definition at line 249 of file binary_operator.cpp.
Substitutes var(index) with the expression sub.
index | subst. index |
sub | the substitution |
Implements SmoothOperator.
Implemented in Power, Product, Subtraction, Addition, and Quotient.
|
friend |
Definition at line 60 of file binary_operator.hpp.
|
protected |
The first summand.
Definition at line 458 of file binary_operator.hpp.
|
protected |
The results for the first summand.
Definition at line 468 of file binary_operator.hpp.
|
protected |
The second summand.
Definition at line 459 of file binary_operator.hpp.
|
protected |
The results for the second summand.
Definition at line 470 of file binary_operator.hpp.
|
protected |
The size of the buffer.
Definition at line 481 of file binary_operator.hpp.
|
protected |
Definition at line 483 of file binary_operator.hpp.
|
protected |
The derivative of the first summand.
Definition at line 462 of file binary_operator.hpp.
|
protected |
The results for the first derivative of the first summand.
Definition at line 474 of file binary_operator.hpp.
|
protected |
The derivative of the second summand.
Definition at line 464 of file binary_operator.hpp.
|
protected |
The results for the first derivative of the second summand.
Definition at line 477 of file binary_operator.hpp.
|
protected |
Definition at line 484 of file binary_operator.hpp.