The code is:
double twox_darg0(double x) {
double _d_x = 1;
return 0 * x + 2 * _d_x;
}
Although zero terms make it easy to see how the chain rule was applied and might be useful for debugging, they also make the output longer and more difficult to read. It would be nice to have an option for dump or a compile-time flag to do some simplifications on the generated code -- namely, eliminate multiplication by 0. I know that it's probably optimized out at later compilation stages but maybe something simple could be done in clad too.
Gives the output:
Although zero terms make it easy to see how the chain rule was applied and might be useful for debugging, they also make the output longer and more difficult to read. It would be nice to have an option for
dump
or a compile-time flag to do some simplifications on the generated code -- namely, eliminate multiplication by0
. I know that it's probably optimized out at later compilation stages but maybe something simple could be done in clad too.