[ADOL-C] "if" brach dependent on adoubles

RICARDO PUENTE RICO ricardo.puente at upm.es
Fri Sep 27 09:37:08 EDT 2013



Hello all,


I´m working with a code that uses some conditional branches where the 
condition is specified on the value of an adouble. For example

int tag=0,keep=0;

trace_on(tag,keep);

adouble eg,a,b,c;

eg = fun(a,b,c);

if(eg < 0)
   Some stuff..
else
   Other stuff...
endif

trace_off();

This compiles but complains at runtime with the following message:

ADOL-C Warning: Branch switch detected in comparison (operator 
neq_zero).
Forward sweep aborted! Retaping recommended!

I understand the problem has to do with the handling of the continuity 
issues generated by the code branching, but I haven´t been able to 
solve the problem.

Things that come to mind are:

   - In my case, no derivative value depends on eg. But as its own value 
depends on adoubles, it needs to be an adouble too.
     Is there a conversion method from adoubles to passive types that 
I´m not aware of?

   - Retaping. This is what the error suggests, but I really don´t know 
how to implement it. I´ve tried using different values for "tag",
     "keep" and "repeat" to no avail.

   - Using the condassign() method. I haven´t found yet a way to make 
it work in my case, where the branches comprise a lot of code, not
     merely assignments, but I´m still thinking on it.

Regards,

-- 
RICARDO PUENTE RICO
Universidad Politecnica de Madrid


More information about the ADOL-C mailing list