Nested Conditional with c++


#1

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.


#2

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?