Abstract base class for all scalar-valued unary operators within the symbolic operators family. More...
#include <unary_operator.hpp>
Public Member Functions | |
virtual returnValue | AD_backward (int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS) |
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 Operator * | AD_forward (int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS) |
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) |
virtual returnValue | AD_symmetric (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 returnValue | clearBuffer () |
virtual Operator * | clone () const =0 |
Operator * | differentiate (int index) |
virtual returnValue | enumerateVariables (SymbolicIndexList *indexList) |
virtual returnValue | evaluate (int number, double *x, double *result) |
virtual returnValue | evaluate (EvaluationBase *x)=0 |
virtual CurvatureType | getCurvature () |
virtual MonotonicityType | getMonotonicity () |
virtual OperatorName | getName () |
virtual BooleanType | isDependingOn (VariableType var) const |
virtual BooleanType | isDependingOn (int dim, VariableType *varType, int *component, BooleanType *implicit_dep) |
virtual BooleanType | isLinearIn (int dim, VariableType *varType, int *component, BooleanType *implicit_dep) |
virtual NeutralElement | isOneOrZero () const |
virtual BooleanType | isPolynomialIn (int dim, VariableType *varType, int *component, BooleanType *implicit_dep) |
virtual BooleanType | isRationalIn (int dim, VariableType *varType, int *component, BooleanType *implicit_dep) |
virtual BooleanType | isSymbolic () const |
virtual BooleanType | isVariable (VariableType &varType, int &component) const |
virtual returnValue | loadIndices (SymbolicIndexList *indexList) |
UnaryOperator & | operator= (const UnaryOperator &arg) |
virtual std::ostream & | print (std::ostream &stream) const |
virtual returnValue | setCurvature (CurvatureType curvature_) |
virtual returnValue | setMonotonicity (MonotonicityType monotonicity_) |
virtual Operator * | substitute (int index, const Operator *sub)=0 |
UnaryOperator () | |
UnaryOperator (Operator *_argument) | |
UnaryOperator (const UnaryOperator &arg) | |
virtual | ~UnaryOperator () |
Protected Member Functions | |
returnValue | ADbackwardProtected (int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS) |
Operator * | ADforwardProtected (int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS) |
returnValue | ADsymmetricProtected (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 returnValue | setVariableExportName (const VariableType &_type, const std::vector< std::string > &_name) |
Protected Attributes | |
Operator * | argument |
double * | argument_result |
int | bufferSize |
std::string | cName |
CurvatureType | curvature |
Operator * | dargument |
double * | dargument_result |
double(* | ddfcn )(double) |
Operator * | derivative |
Operator * | derivative2 |
double(* | dfcn )(double) |
double(* | fcn )(double) |
MonotonicityType | monotonicity |
OperatorName | operatorName |
Abstract base class for all scalar-valued unary operators within the symbolic operators family.
The class UnaryOperator serves as a base class all scalar-valued unary operators within the symbolic operators family.
Definition at line 56 of file unary_operator.hpp.
Default constructor.
Definition at line 42 of file unary_operator.cpp.
UnaryOperator::UnaryOperator | ( | Operator * | _argument | ) |
Default constructor.
Definition at line 53 of file unary_operator.cpp.
UnaryOperator::UnaryOperator | ( | const UnaryOperator & | arg | ) |
Copy constructor (deep copy).
Definition at line 74 of file unary_operator.cpp.
UnaryOperator::~UnaryOperator | ( | ) | [virtual] |
Default destructor.
Definition at line 113 of file unary_operator.cpp.
returnValue UnaryOperator::AD_backward | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
Operator * | seed, | ||
Operator ** | df, | ||
int & | nNewIS, | ||
TreeProjection *** | newIS | ||
) | [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.
Definition at line 226 of file unary_operator.cpp.
returnValue UnaryOperator::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 |
Implements SmoothOperator.
Definition at line 381 of file unary_operator.cpp.
returnValue UnaryOperator::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 |
ddf | the 2nd derivative |
Implements SmoothOperator.
Definition at line 406 of file unary_operator.cpp.
Operator * UnaryOperator::AD_forward | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
Operator ** | seed, | ||
int & | nNewIS, | ||
TreeProjection *** | newIS | ||
) | [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.
Definition at line 215 of file unary_operator.cpp.
returnValue UnaryOperator::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 |
Implements SmoothOperator.
Definition at line 370 of file unary_operator.cpp.
returnValue UnaryOperator::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 |
Implements SmoothOperator.
Definition at line 351 of file unary_operator.cpp.
returnValue UnaryOperator::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 |
ddf | the 2nd derivative |
Implements SmoothOperator.
Definition at line 386 of file unary_operator.cpp.
returnValue UnaryOperator::AD_symmetric | ( | 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] |
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.
Definition at line 239 of file unary_operator.cpp.
returnValue UnaryOperator::ADbackwardProtected | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
Operator * | seed, | ||
Operator ** | df, | ||
int & | nNewIS, | ||
TreeProjection *** | newIS | ||
) | [protected] |
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 |
Definition at line 509 of file unary_operator.cpp.
Operator * UnaryOperator::ADforwardProtected | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
Operator ** | seed, | ||
int & | nNewIS, | ||
TreeProjection *** | newIS | ||
) | [protected] |
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 |
Definition at line 492 of file unary_operator.cpp.
returnValue UnaryOperator::ADsymmetricProtected | ( | 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 | ||
) | [protected] |
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 |
Definition at line 529 of file unary_operator.cpp.
returnValue UnaryOperator::clearBuffer | ( | ) | [virtual] |
Clears the buffer and resets the buffer size
to 1.
Implements SmoothOperator.
Definition at line 432 of file unary_operator.cpp.
virtual Operator* UnaryOperator::clone | ( | ) | const [pure virtual] |
Operator * UnaryOperator::differentiate | ( | int | index | ) | [virtual] |
Returns the derivative of the expression with respect
to the variable var(index).
index | diff. index |
Implements SmoothOperator.
Definition at line 485 of file unary_operator.cpp.
returnValue UnaryOperator::enumerateVariables | ( | SymbolicIndexList * | indexList | ) | [virtual] |
Enumerates all variables based on a common
IndexList.
Implements SmoothOperator.
Definition at line 445 of file unary_operator.cpp.
returnValue UnaryOperator::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 |
Implements SmoothOperator.
Definition at line 201 of file unary_operator.cpp.
virtual returnValue UnaryOperator::evaluate | ( | EvaluationBase * | x | ) | [pure virtual] |
CurvatureType UnaryOperator::getCurvature | ( | ) | [virtual] |
Returns the curvature of the expression
Implements SmoothOperator.
Reimplemented in Exp, and Logarithm.
Definition at line 328 of file unary_operator.cpp.
MonotonicityType UnaryOperator::getMonotonicity | ( | ) | [virtual] |
Returns the monotonicity of the expression.
Implements SmoothOperator.
Definition at line 319 of file unary_operator.cpp.
OperatorName UnaryOperator::getName | ( | ) | [virtual] |
Asks the expression for its name.
Implements SmoothOperator.
Definition at line 456 of file unary_operator.cpp.
BooleanType UnaryOperator::isDependingOn | ( | VariableType | var | ) | const [virtual] |
Asks the expression whether it is depending on a certian type of
variable.
Implements SmoothOperator.
Definition at line 264 of file unary_operator.cpp.
BooleanType UnaryOperator::isDependingOn | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
BooleanType * | implicit_dep | ||
) | [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 270 of file unary_operator.cpp.
BooleanType UnaryOperator::isLinearIn | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
BooleanType * | implicit_dep | ||
) | [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.
Definition at line 280 of file unary_operator.cpp.
NeutralElement UnaryOperator::isOneOrZero | ( | ) | const [virtual] |
Checks whether the expression is zero or one
Implements SmoothOperator.
Definition at line 261 of file unary_operator.cpp.
BooleanType UnaryOperator::isPolynomialIn | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
BooleanType * | implicit_dep | ||
) | [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.
Definition at line 293 of file unary_operator.cpp.
BooleanType UnaryOperator::isRationalIn | ( | int | dim, |
VariableType * | varType, | ||
int * | component, | ||
BooleanType * | implicit_dep | ||
) | [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.
Definition at line 306 of file unary_operator.cpp.
BooleanType UnaryOperator::isSymbolic | ( | ) | const [virtual] |
Asks whether all elements are purely symbolic.
Implements SmoothOperator.
Definition at line 468 of file unary_operator.cpp.
BooleanType UnaryOperator::isVariable | ( | VariableType & | varType, |
int & | component | ||
) | const [virtual] |
Asks the expression whether it is a variable.
Implements SmoothOperator.
Definition at line 427 of file unary_operator.cpp.
returnValue UnaryOperator::loadIndices | ( | SymbolicIndexList * | indexList | ) | [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.
Implements SmoothOperator.
Definition at line 462 of file unary_operator.cpp.
UnaryOperator & UnaryOperator::operator= | ( | const UnaryOperator & | arg | ) |
Assignment Operator (deep copy).
Definition at line 145 of file unary_operator.cpp.
std::ostream & UnaryOperator::print | ( | std::ostream & | stream | ) | const [virtual] |
Prints the expression into a stream.
Implements SmoothOperator.
Definition at line 421 of file unary_operator.cpp.
returnValue UnaryOperator::setCurvature | ( | CurvatureType | curvature_ | ) | [virtual] |
Overwrites the curvature of the expression.
(For the case that the curvature is explicitly known)
Implements SmoothOperator.
Definition at line 344 of file unary_operator.cpp.
returnValue UnaryOperator::setMonotonicity | ( | MonotonicityType | monotonicity_ | ) | [virtual] |
Overwrites the monotonicity of the expression.
(For the case that the monotonicity is explicitly known)
Implements SmoothOperator.
Definition at line 337 of file unary_operator.cpp.
returnValue UnaryOperator::setVariableExportName | ( | const VariableType & | _type, |
const std::vector< std::string > & | _name | ||
) | [protected, virtual] |
Sets the name of the variable that is used for code export.
Reimplemented from Operator.
Definition at line 475 of file unary_operator.cpp.
virtual Operator* UnaryOperator::substitute | ( | int | index, |
const Operator * | sub | ||
) | [pure virtual] |
Operator* UnaryOperator::argument [protected] |
The argument
Definition at line 460 of file unary_operator.hpp.
double* UnaryOperator::argument_result [protected] |
The results for the argument.
Definition at line 462 of file unary_operator.hpp.
int UnaryOperator::bufferSize [protected] |
The size of the buffer
Definition at line 464 of file unary_operator.hpp.
std::string UnaryOperator::cName [protected] |
Definition at line 469 of file unary_operator.hpp.
CurvatureType UnaryOperator::curvature [protected] |
Definition at line 466 of file unary_operator.hpp.
Operator* UnaryOperator::dargument [protected] |
The derivative
Definition at line 461 of file unary_operator.hpp.
double* UnaryOperator::dargument_result [protected] |
The results for the first derivative
Definition at line 463 of file unary_operator.hpp.
double(* UnaryOperator::ddfcn)(double) [protected] |
Definition at line 473 of file unary_operator.hpp.
Operator* UnaryOperator::derivative [protected] |
The derivative of this unary operator.
Definition at line 457 of file unary_operator.hpp.
Operator* UnaryOperator::derivative2 [protected] |
The second order derivative of this unary operator.
Definition at line 458 of file unary_operator.hpp.
double(* UnaryOperator::dfcn)(double) [protected] |
Definition at line 472 of file unary_operator.hpp.
double(* UnaryOperator::fcn)(double) [protected] |
Definition at line 471 of file unary_operator.hpp.
MonotonicityType UnaryOperator::monotonicity [protected] |
Definition at line 467 of file unary_operator.hpp.
OperatorName UnaryOperator::operatorName [protected] |
Definition at line 468 of file unary_operator.hpp.