Nested Conditional with c++


I have to compute gradient of some code in c++ with nested conditionals.
Can anybody point me to some good resources for starting ?
Thank you.


Do you know that those gradients exist?

The problem with conditionals isn’t that they make autodiff not work mechanically – plenty of Stan programs autodiff around if statements.

The issue is that these conditionals may make the function mathematically non-differentiable. Do you know which case you are?