<span class="gI">Dear all, <br><br>I have a function called eval(...) which calls to eval2(...):<br><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">double crSLP::eval(const vector<double> & vars)</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">{</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">...</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">trace_on(1);</span><br style="color: rgb(51, 102, 255);">
<br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> valorA=eval2(ctesMudasA,ctesReales,currentVarsA);</span><br style="color: rgb(51, 102, 255);"><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">trace_off(1);</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">...</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">}</span><br><br><br>And then this eval2(...) function, internally calls to : <br><br><span style="color: rgb(51, 102, 255);">class funSIN: public funcion<adouble></span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">{</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> string toString() const</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> { return "sin"; }</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> double eval(const vector<adouble> & args)</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> {</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> double valor, aux;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> adouble aux2;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> </span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> if(args.size() != 1) throw runtime_error("funSIN::eval(): n args incorrecto")</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> {</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> adouble args[0] >>= valor;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> aux = sin(valor);</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> aux2 <<= aux;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> return aux2;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> }</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> }</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> unsigned int aridad()</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> { return 1; }</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">};</span><br><br>Well, if i want to use sin() function of mathcalls.h, I need to convert adouble to double (adouble args[0] >>= valor;) .<br><br>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 ? <br>
<br>If i have to define an active section in class funSIN too, will be on this way:<br><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">trace_on(1);</span><br style="color: rgb(51, 102, 255);">
<br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">adouble args[0] >>= valor;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);"> aux = sin(valor);</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);"> aux2 <<= aux;</span><br style="color: rgb(51, 102, 255);"><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">trace_off(1);<br><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);">Thanks a lot,</span><br style="color: rgb(0, 0, 0);"><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">Borja</span><br style="color: rgb(51, 102, 255);"></span><br></span>