Public Member Functions | Protected Member Functions | Protected Attributes | Friends

Abstract base class for all scalar-valued binary operators within the symbolic operators family. More...

#include <binary_operator.hpp>

Inheritance diagram for BinaryOperator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual returnValue AD_backward (int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)=0
virtual returnValue AD_backward (int number, double seed, double *df)=0
virtual returnValue AD_backward2 (int number, double seed1, double seed2, double *df, double *ddf)=0
virtual OperatorAD_forward (int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)=0
virtual returnValue AD_forward (int number, double *x, double *seed, double *f, double *df)=0
virtual returnValue AD_forward (int number, double *seed, double *df)=0
virtual returnValue AD_forward2 (int number, double *seed1, double *seed2, double *df, double *ddf)=0
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)=0
 BinaryOperator ()
 BinaryOperator (Operator *_argument1, Operator *_argument2)
 BinaryOperator (const BinaryOperator &arg)
virtual returnValue clearBuffer ()
virtual Operatorclone () const =0
virtual Operatordifferentiate (int index)=0
virtual returnValue enumerateVariables (SymbolicIndexList *indexList)
virtual returnValue evaluate (int number, double *x, double *result)=0
virtual returnValue evaluate (EvaluationBase *x)=0
virtual CurvatureType getCurvature ()=0
virtual MonotonicityType getMonotonicity ()=0
virtual OperatorName getName ()=0
virtual returnValue initDerivative ()
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)=0
virtual NeutralElement isOneOrZero () const
virtual BooleanType isPolynomialIn (int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual BooleanType isRationalIn (int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual BooleanType isSymbolic () const
virtual BooleanType isVariable (VariableType &varType, int &component) const
virtual returnValue loadIndices (SymbolicIndexList *indexList)
BinaryOperatoroperator= (const BinaryOperator &arg)
virtual std::ostream & print (std::ostream &stream) const =0
virtual returnValue setCurvature (CurvatureType curvature_)
virtual returnValue setMonotonicity (MonotonicityType monotonicity_)
virtual returnValue setVariableExportName (const VariableType &_type, const std::vector< std::string > &_name)
virtual Operatorsubstitute (int index, const Operator *sub)=0
virtual ~BinaryOperator ()

Protected Member Functions

void copy (const BinaryOperator &arg)
void deleteAll ()

Protected Attributes

Operatorargument1
double * argument1_result
Operatorargument2
double * argument2_result
int bufferSize
CurvatureType curvature
Operatordargument1
double * dargument1_result
Operatordargument2
double * dargument2_result
MonotonicityType monotonicity

Friends

class Power_Int

Detailed Description

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.

Author:
Boris Houska, Hans Joachim Ferreau

Definition at line 56 of file binary_operator.hpp.


Constructor & Destructor Documentation

Default constructor.

Definition at line 42 of file binary_operator.cpp.

BinaryOperator::BinaryOperator ( Operator _argument1,
Operator _argument2 
)

Default constructor.

Definition at line 47 of file binary_operator.cpp.

Copy constructor (deep copy).

Definition at line 65 of file binary_operator.cpp.

Default destructor.

Definition at line 73 of file binary_operator.cpp.


Member Function Documentation

virtual returnValue BinaryOperator::AD_backward ( int  dim,
VariableType varType,
int *  component,
Operator seed,
Operator **  df,
int &  nNewIS,
TreeProjection ***  newIS 
) [pure virtual]

Automatic Differentiation in backward mode on the symbolic
level. This function generates an expression for a
backward derivative

Returns:
SUCCESSFUL_RETURN
Parameters:
dimnumber of directions
varTypethe variable types
componentand their components
seedthe backward seed
dfthe result
nNewISthe number of new IS
newISthe new IS-pointer

Implements SmoothOperator.

Implemented in Power, Product, Quotient, Subtraction, and Addition.

virtual returnValue BinaryOperator::AD_backward ( int  number,
double  seed,
double *  df 
) [pure virtual]

Automatic Differentiation in backward mode based on
buffered values

Returns:
SUCCESFUL_RETURN
RET_NAN
Parameters:
numberthe buffer position
seedthe seed
dfthe derivative of the expression

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Power, and Quotient.

virtual returnValue BinaryOperator::AD_backward2 ( int  number,
double  seed1,
double  seed2,
double *  df,
double *  ddf 
) [pure virtual]

Automatic Differentiation in backward mode for 2nd order
derivatives based on buffered values.

Returns:
SUCCESFUL_RETURN
RET_NAN
Parameters:
numberthe buffer position
seed1the seed1
seed2the seed2
dfthe 1st derivative of the expression
ddfthe 2nd derivative of the expression

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Power, and Quotient.

virtual Operator* BinaryOperator::AD_forward ( int  dim,
VariableType varType,
int *  component,
Operator **  seed,
int &  nNewIS,
TreeProjection ***  newIS 
) [pure virtual]

Automatic Differentiation in forward mode on the symbolic
level. This function generates an expression for a
forward derivative

Returns:
SUCCESSFUL_RETURN
Parameters:
dimdimension of the seed
varTypethe variable types
componentand their components
seedthe forward seed
nNewISthe number of new IS
newISthe new IS-pointer

Implements SmoothOperator.

Implemented in Power, Product, Quotient, Subtraction, and Addition.

virtual returnValue BinaryOperator::AD_forward ( int  number,
double *  x,
double *  seed,
double *  f,
double *  df 
) [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)

Returns:
SUCCESFUL_RETURN
RET_NAN
Parameters:
numberstorage position
xThe evaluation point x
seedthe seed
fthe value of the expression at x
dfthe derivative of the expression

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Power, and Quotient.

virtual returnValue BinaryOperator::AD_forward ( int  number,
double *  seed,
double *  df 
) [pure virtual]

Automatic Differentiation in forward mode.
This function uses the intermediate
results from a buffer

Returns:
SUCCESFUL_RETURN
RET_NAN
Parameters:
numberstorage position
seedthe seed
dfthe derivative of the expression

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Power, and Quotient.

virtual returnValue BinaryOperator::AD_forward2 ( int  number,
double *  seed1,
double *  seed2,
double *  df,
double *  ddf 
) [pure virtual]

Automatic Differentiation in forward mode for
2nd derivatives.
This function uses intermediate
results from a buffer.

Returns:
SUCCESFUL_RETURN
RET_NAN
Parameters:
numberthe buffer position
seed1the seed
seed2the seed for the first derivative
dfthe derivative of the expression
ddfthe 2nd derivative of the expression

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Power, and Quotient.

virtual returnValue BinaryOperator::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 
) [pure virtual]

Automatic Differentiation in symmetric mode on the symbolic
level. This function generates an expression for a
second order derivative.

Returns:
SUCCESSFUL_RETURN
Parameters:
dimnumber of directions
varTypethe variable types
componentand their components
lthe backward seed
Sforward seed matrix
dimSdimension of forward seed
dfSfirst order foward result
ldffirst order backward result
Hupper trianglular part of the Hessian
nNewLISthe number of newLIS
newLISthe new LIS-pointer
nNewSISthe number of newSIS
newSISthe new SIS-pointer
nNewHISthe number of newHIS
newHISthe new HIS-pointer

Implements SmoothOperator.

Implemented in Power, Product, Subtraction, Addition, and Quotient.

Clears the buffer and resets the buffer size
to 1.

Returns:
SUCCESFUL_RETURN

Implements SmoothOperator.

Definition at line 129 of file binary_operator.cpp.

virtual Operator* BinaryOperator::clone ( ) const [pure virtual]

Provides a deep copy of the expression.

Returns:
a clone of the expression.

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Quotient, and Power.

void BinaryOperator::copy ( const BinaryOperator arg) [protected]

Definition at line 191 of file binary_operator.cpp.

void BinaryOperator::deleteAll ( ) [protected]

Definition at line 231 of file binary_operator.cpp.

virtual Operator* BinaryOperator::differentiate ( int  index) [pure virtual]

Returns the derivative of the expression with respect
to the variable var(index).

Returns:
The expression for the derivative.
Parameters:
indexdiff. index

Implements SmoothOperator.

Implemented in Power, Product, Quotient, Subtraction, and Addition.

Enumerates all variables based on a common
IndexList.

Returns:
SUCCESFUL_RETURN

Implements SmoothOperator.

Definition at line 144 of file binary_operator.cpp.

virtual returnValue BinaryOperator::evaluate ( int  number,
double *  x,
double *  result 
) [pure virtual]

Evaluates the expression and stores the intermediate
results in a buffer (needed for automatic differentiation
in backward mode)

Returns:
SUCCESFUL_RETURN
RET_NAN
Parameters:
numberstorage position
xthe input variable x
resultthe result

Implements SmoothOperator.

Implemented in Power, Product, Quotient, Subtraction, and Addition.

virtual returnValue BinaryOperator::evaluate ( EvaluationBase x) [pure virtual]

Evaluates the expression (templated version)

Implements SmoothOperator.

Implemented in Power, Product, Quotient, Subtraction, and Addition.

virtual CurvatureType BinaryOperator::getCurvature ( ) [pure virtual]

Returns the curvature of the expression

Returns:
CT_CONSTANT
CT_AFFINE
CT_CONVEX
CT_CONCAVE

Implements SmoothOperator.

Implemented in Power, Addition, Product, Subtraction, and Quotient.

Returns the monotonicity of the expression.

Returns:
MT_NONDECREASING
MT_NONINCREASING
MT_NONMONOTONIC

Implements SmoothOperator.

Implemented in Power, Addition, Product, Subtraction, and Quotient.

virtual OperatorName BinaryOperator::getName ( ) [pure virtual]

Asks the expression for its name.

Returns:
the name of the expression.

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Quotient, and Power.

Reimplemented from Operator.

Reimplemented in Quotient, and Power.

Definition at line 260 of file binary_operator.cpp.

Asks the expression whether it is depending on a certian type of
variable.

Returns:
BT_TRUE if a dependency is detected,
BT_FALSE otherwise.

Implements SmoothOperator.

Definition at line 91 of file binary_operator.cpp.

BooleanType BinaryOperator::isDependingOn ( int  dim,
VariableType varType,
int *  component,
BooleanType implicit_dep 
) [virtual]

Checks whether the expression is depending on a variable

Returns:
BT_FALSE if no dependence is detected
BT_TRUE otherwise
Parameters:
dimnumber of directions
varTypethe variable types
componentand their components
implicit_depimplicit dependencies

Implements SmoothOperator.

Definition at line 101 of file binary_operator.cpp.

virtual BooleanType BinaryOperator::isLinearIn ( int  dim,
VariableType varType,
int *  component,
BooleanType implicit_dep 
) [pure virtual]

Checks whether the expression is linear in
(or not depending on) a variable

Returns:
BT_FALSE if no linearity is
detected
BT_TRUE otherwise
Parameters:
dimnumber of directions
varTypethe variable types
componentand their components
implicit_depimplicit dependencies

Implements SmoothOperator.

Implemented in Power, Product, Subtraction, Addition, and Quotient.

Checks whether the expression is zero or one

Returns:
NE_ZERO
NE_ONE
NE_NEITHER_ONE_NOR_ZERO

Implements SmoothOperator.

Definition at line 89 of file binary_operator.cpp.

virtual BooleanType BinaryOperator::isPolynomialIn ( int  dim,
VariableType varType,
int *  component,
BooleanType implicit_dep 
) [pure virtual]

Checks whether the expression is polynomial in
the specified variables

Returns:
BT_FALSE if the expression is not polynomial
BT_TRUE otherwise
Parameters:
dimnumber of directions
varTypethe variable types
componentand their components
implicit_depimplicit dependencies

Implements SmoothOperator.

Implemented in Power, Product, Subtraction, Addition, and Quotient.

virtual BooleanType BinaryOperator::isRationalIn ( int  dim,
VariableType varType,
int *  component,
BooleanType implicit_dep 
) [pure virtual]

Checks whether the expression is rational in
the specified variables

Returns:
BT_FALSE if the expression is not rational
BT_TRUE otherwise
Parameters:
dimnumber of directions
varTypethe variable types
componentand their components
implicit_depimplicit dependencies

Implements SmoothOperator.

Implemented in Power, Product, Subtraction, Addition, and Quotient.

Asks whether all elements are purely symbolic.

Returns:
BT_TRUE if the complete tree is symbolic.
BT_FALSE otherwise (e.g. if C functions are linked).

Implements SmoothOperator.

Definition at line 176 of file binary_operator.cpp.

BooleanType BinaryOperator::isVariable ( VariableType varType,
int &  component 
) const [virtual]

Asks the expression whether it is a variable.

Returns:
The answer.

Implements SmoothOperator.

Definition at line 156 of file binary_operator.cpp.

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.

Returns:
the name of the expression.
Parameters:
indexListThe 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.

virtual std::ostream& BinaryOperator::print ( std::ostream &  stream) const [pure virtual]

Prints the expression into a stream.

Returns:
SUCCESFUL_RETURN

Implements SmoothOperator.

Implemented in Addition, Product, Subtraction, Power, and Quotient.

Overwrites the curvature of the expression.
(For the case that the curvature is explicitly known)

Returns:
SUCCESSFUL_RETURN

Implements SmoothOperator.

Definition at line 122 of file binary_operator.cpp.

Overwrites the monotonicity of the expression.
(For the case that the monotonicity is explicitly known)

Returns:
SUCCESSFUL_RETURN

Implements SmoothOperator.

Definition at line 115 of file binary_operator.cpp.

returnValue BinaryOperator::setVariableExportName ( const VariableType _type,
const std::vector< std::string > &  _name 
) [virtual]

Sets the name of the variable that is used for code export.

Returns:
SUCCESSFUL_RETURN

Reimplemented from Operator.

Definition at line 249 of file binary_operator.cpp.

virtual Operator* BinaryOperator::substitute ( int  index,
const Operator sub 
) [pure virtual]

Substitutes var(index) with the expression sub.

Returns:
The substituted expression.
Parameters:
indexsubst. index
subthe substitution

Implements SmoothOperator.

Implemented in Power, Product, Subtraction, Addition, and Quotient.


Friends And Related Function Documentation

friend class Power_Int [friend]

Definition at line 60 of file binary_operator.hpp.


Member Data Documentation

The first summand.

Definition at line 458 of file binary_operator.hpp.

double* BinaryOperator::argument1_result [protected]

The results for the first summand.

Definition at line 468 of file binary_operator.hpp.

The second summand.

Definition at line 459 of file binary_operator.hpp.

double* BinaryOperator::argument2_result [protected]

The results for the second summand.

Definition at line 470 of file binary_operator.hpp.

int BinaryOperator::bufferSize [protected]

The size of the buffer.

Definition at line 481 of file binary_operator.hpp.

Definition at line 483 of file binary_operator.hpp.

The derivative of the first summand.

Definition at line 462 of file binary_operator.hpp.

double* BinaryOperator::dargument1_result [protected]

The results for the first derivative of the first summand.

Definition at line 474 of file binary_operator.hpp.

The derivative of the second summand.

Definition at line 464 of file binary_operator.hpp.

double* BinaryOperator::dargument2_result [protected]

The results for the first derivative of the second summand.

Definition at line 477 of file binary_operator.hpp.

Definition at line 484 of file binary_operator.hpp.


The documentation for this class was generated from the following files:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:01:37