139 for( run1 = 0; run1 <
maxAlloc; run1++ ){
143 for( run2 = 0; run2 <
nn; run2++ ){
160 for( run1 = 0; run1 <
maxAlloc; run1++ ){
176 for( run1 = 0; run1 <
maxAlloc; run1++ ){
177 thisFunction.
xStore [run1] =
new double[thisFunction.
nn];
178 thisFunction.
seedStore[run1] =
new double[thisFunction.
nn];
179 for( run2 = 0; run2 < thisFunction.
nn; run2++ ){
180 thisFunction.
xStore [run1][run2] = 0.0;
181 thisFunction.
seedStore[run1][run2] = 0.0;
190 for( run1 = 0; run1 <
dim; run1++ ){
231 std::cout <<
"C-function evaluation: ";
232 for (run1 = 0; run1 <
dim; run1++)
233 std::cout <<
"f[" << run1 <<
"] = " << std::scientific << result[ run1 ] << std::endl;
248 xStore= (
double**)realloc(
xStore, (number+1)*
sizeof(
double*));
249 for( run1 = maxAlloc; (int) run1 < number+1; run1++ ){
253 for( run1 = maxAlloc; (int) run1 < number+1; run1++ ){
259 for( run2 = 0; run2 <
nn; run2++ ){
260 xStore[number][run2] = x[run2];
281 for( run1 = 0; run1 <
nn; run1++ ){
282 x[run1] = x[run1] +
SQRT_EPS*seed[run1];
289 for( run1 = 0; run1 <
dim; run1++ ){
290 df[run1] = ( df[run1] - f[run1] )/
SQRT_EPS;
292 for( run1 = 0; run1 <
nn; run1++ ){
293 x[run1] = x[run1] -
SQRT_EPS*seed[run1];
306 xStore= (
double**)realloc(
xStore, (number+1)*
sizeof(
double*));
307 for( run1 = maxAlloc; (int) run1 < number+1; run1++ ){
311 for( run1 = maxAlloc; (int) run1 < number+1; run1++ ){
320 for( run1 = 0; run1 <
nn; run1++ ){
322 xStore[number][run1] = x [run1];
332 for( run1 = 0; run1 <
nn; run1++ ){
333 xStore[number][run1] = x[run1];
335 x [run1] = x[run1] +
SQRT_EPS*seed[run1];
340 for( run1 = 0; run1 <
dim; run1++ ){
341 df[run1] = ( df[run1] - f[run1] )/
SQRT_EPS;
343 for( run1 = 0; run1 <
nn; run1++ ){
344 x[run1] =
xStore[number][run1];
357 double *f =
new double[
dim];
362 for( run1 = 0; run1 <
nn; run1++ )
373 for( run1 = 0; run1 <
nn; run1++ ){
380 for( run1 = 0; run1 <
dim; run1++ ){
381 df[run1] = ( df[run1] - f[run1] )/
SQRT_EPS;
383 for( run1 = 0; run1 <
nn; run1++ ){
387 for( run1 = 0; run1 <
nn; run1++ ){
412 double *f =
new double[
dim];
416 for( run1 = 0; run1 <
nn; run1++ )
432 double *f1 =
new double[
dim];
433 double *f2 =
new double[
dim];
434 double *f3 =
new double[
dim];
435 double *f4 =
new double[
dim];
443 for( run1 = 0; run1 <
nn; run1++ ){
447 for( run1 = 0; run1 <
dim; run1++ ){
448 df[run1] = ( df[run1] - f1[run1] )/
SQRT_EPS;
450 for( run1 = 0; run1 <
nn; run1++ ){
454 for( run1 = 0; run1 <
nn; run1++ ){
458 for( run1 = 0; run1 <
dim; run1++ ){
459 ddf[run1] = ( ddf[run1] - f1[run1] )/
SQRT_EPS;
461 for( run1 = 0; run1 <
nn; run1++ ){
469 for( run1 = 0; run1 <
nn; run1++ ){
475 for( run1 = 0; run1 <
nn; run1++ ){
482 for( run1 = 0; run1 <
nn; run1++ ){
488 for( run1 = 0; run1 <
nn; run1++ ){
495 for( run1 = 0; run1 <
nn; run1++ ){
500 for( run1 = 0; run1 <
dim; run1++ ){
501 ddf[run1] = ddf[run1] + ( f1[run1] - f2[run1] - f3[run1] + f4[run1] )/
SQRT_EPS;
524 for( run1 = 1; run1 <
maxAlloc; run1++ ){
531 xStore= (
double**)realloc(
xStore, maxAlloc*
sizeof(
double*) );
virtual returnValue AD_backward2(int number, double *seed1, double *seed2, double *df, double *ddf)
Allows to pass back messages to the calling function.
virtual void evaluateCFunction(double *x, double *result)
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
#define CLOSE_NAMESPACE_ACADO
void(* cFcnDPtr)(int number, double *x, double *seed, double *f, double *df, void *userData)
Base class for all variables within the symbolic expressions family.
void copy(const CFunction &arg)
virtual Expression operator()(const Expression &arg)
const double FOURTH_ROOT_EPS
virtual returnValue evaluate(double *x, double *result)
virtual uint getDim() const
virtual returnValue setUserData(void *user_data_)
The class COperator is an auxiliary class to use C-Functions within a function evaluation tree...
CFunction & operator=(const CFunction &rhs)
virtual returnValue AD_backward(double *seed, double *df)
#define BEGIN_NAMESPACE_ACADO
void(* cFcnPtr)(double *x, double *f, void *userData)
virtual returnValue clearBuffer()
virtual returnValue AD_forward(double *x, double *seed, double *f, double *df)
#define ACADOERROR(retval)