00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef ACADO_TOOLKIT_C_OPERATOR_HPP
00036 #define ACADO_TOOLKIT_C_OPERATOR_HPP
00037
00038
00039 #include <acado/symbolic_expression/symbolic_expression.hpp>
00040 #include <acado/function/c_function.hpp>
00041
00042
00043
00044 BEGIN_NAMESPACE_ACADO
00045
00046
00058 class COperator : public SmoothOperator{
00059
00060 public:
00061
00063 COperator();
00064
00066 COperator( const CFunction &fcn, const Expression &arg, int component_ );
00067
00069 COperator( const COperator &arg );
00070
00072 ~COperator();
00073
00075 COperator& operator=( const COperator &arg );
00076
00078 int increaseID();
00079
00080
00081
00088 virtual returnValue evaluate( int number ,
00089 double *x ,
00090 double *result );
00091
00092
00094 virtual returnValue evaluate( EvaluationBase *x );
00095
00096
00097
00103 virtual Operator* differentiate( int index );
00104
00105
00106
00112 virtual Operator* AD_forward( int dim ,
00113 VariableType *varType ,
00114 int *component,
00115 Operator **seed ,
00116 int &nNewIS ,
00117 TreeProjection ***newIS );
00118
00119
00120
00126 virtual returnValue AD_backward( int dim ,
00127 VariableType *varType ,
00128 int *component,
00129 Operator *seed ,
00130 Operator **df ,
00131 int &nNewIS ,
00132 TreeProjection ***newIS );
00133
00134
00140 virtual returnValue AD_symmetric( int dim ,
00141 VariableType *varType ,
00142 int *component ,
00143 Operator *l ,
00144 Operator **S ,
00145 int dimS ,
00146 Operator **dfS ,
00147 Operator **ldf ,
00148 Operator **H ,
00149 int &nNewLIS ,
00150 TreeProjection ***newLIS ,
00151 int &nNewSIS ,
00152 TreeProjection ***newSIS ,
00153 int &nNewHIS ,
00154 TreeProjection ***newHIS );
00155
00156
00157
00162 virtual Operator* substitute( int index ,
00163 const Operator *sub );
00164
00165
00166
00173 virtual NeutralElement isOneOrZero() const;
00174
00175
00176
00182 virtual BooleanType isDependingOn( VariableType var ) const;
00183
00184
00185
00191 virtual BooleanType isDependingOn( int dim ,
00192 VariableType *varType ,
00193 int *component,
00194 BooleanType *implicit_dep );
00195
00196
00197
00198
00206 virtual BooleanType isLinearIn( int dim ,
00207 VariableType *varType ,
00208 int *component,
00209 BooleanType *implicit_dep );
00210
00211
00212
00219 virtual BooleanType isPolynomialIn( int dim ,
00220 VariableType *varType ,
00221 int *component,
00222 BooleanType *implicit_dep );
00223
00224
00225
00232 virtual BooleanType isRationalIn( int dim ,
00233 VariableType *varType ,
00234 int *component,
00235 BooleanType *implicit_dep );
00236
00237
00238
00239
00246 virtual MonotonicityType getMonotonicity( );
00247
00248
00249
00257 virtual CurvatureType getCurvature( );
00258
00259
00260
00266 virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
00267
00268
00269
00270
00276 virtual returnValue setCurvature( CurvatureType curvature_ );
00277
00278
00279
00286 virtual returnValue AD_forward( int number ,
00287 double *seed ,
00288 double *df );
00290
00291
00292
00293
00301 virtual returnValue AD_forward( int number ,
00302 double *x ,
00304 double *seed ,
00305 double *f ,
00307 double *df );
00309
00310
00316 virtual returnValue AD_backward( int number ,
00318 double seed ,
00319 double *df );
00321
00322
00323
00331 virtual returnValue AD_forward2( int number ,
00333 double *seed1 ,
00334 double *seed2 ,
00336 double *df ,
00338 double *ddf );
00340
00341
00342
00343
00344
00345
00351 virtual returnValue AD_backward2( int number ,
00353 double seed1 ,
00354 double seed2 ,
00355 double *df ,
00357 double *ddf );
00359
00360
00361
00365 virtual std::ostream& print( std::ostream& stream ) const;
00366
00367
00368
00372 virtual Operator* clone() const;
00373
00374
00375
00380 virtual returnValue clearBuffer();
00381
00382
00383
00388 virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
00389
00390
00391
00395 virtual OperatorName getName();
00396
00397
00401 virtual BooleanType isVariable( VariableType &varType,
00402 int &component ) const;
00403
00404
00423 virtual returnValue loadIndices( SymbolicIndexList *indexList );
00426
00427
00433 virtual BooleanType isSymbolic() const;
00434
00435
00436
00437
00438
00439
00440 protected:
00441
00444 void copy( const COperator &arg );
00445
00446
00449 void deleteAll();
00450
00451
00452
00453
00454
00455
00456
00457 protected:
00458
00459 CFunction cFunction;
00460 Expression argument;
00462 double **result;
00463 double **d_result;
00465 double **cresult;
00466 double **d_cresult;
00468 int component;
00469 uint bufferSize;
00471 BooleanType first;
00473 int *idx;
00474 int globalTypeID;
00475 static int counter;
00476 };
00477
00478
00479 CLOSE_NAMESPACE_ACADO
00480
00481
00482
00483 #endif
00484