[ADOL-C] active section declaration

borja artamendi borjartamendi at googlemail.com
Sun Jun 27 06:56:42 EDT 2010


Dear all,

I have a function called eval(...) which calls to eval2(...):

double crSLP::eval(const vector<double> & vars)
{
...
trace_on(1);

 valorA=eval2(ctesMudasA,ctesReales,currentVarsA);

trace_off(1);
...
}


And then this eval2(...) function, internally calls to :

class funSIN: public funcion<adouble>
{
  string toString() const
  { return "sin"; }
  double eval(const vector<adouble> & args)
  {
    double valor, aux;
    adouble aux2;

    if(args.size() != 1) throw runtime_error("funSIN::eval(): n args
incorrecto")
    {
      adouble args[0] >>= valor;
      aux = sin(valor);
      aux2 <<= aux;
      return aux2;
    }
  }
  unsigned int aridad()
  { return 1; }
};

Well, if i want to use sin() function of mathcalls.h, I need to convert
adouble to double (adouble args[0] >>= valor;) .

My question is: I have defined the active section on eval which eval calls
to eval2. Then eval2 use class funSIN, so, do i have to define a new active
section in class funSIN, or is not necessary cz i have defined in eval ?

If i have to define an active section in class funSIN too, will be on this
way:

trace_on(1);

adouble args[0] >>= valor;
      aux = sin(valor);
      aux2 <<= aux;

trace_off(1);

Thanks a lot,

Borja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/adol-c/attachments/20100627/a1d5a4b8/attachment.html 


More information about the ADOL-C mailing list