Derivative Code Compilers
I would like to ask if some one can explain to me what are the differences of syntax-directed tangent-linear code and adjoint code.
It is related to derivation of code with a compiler.
I understand that they are different ways to make the derivati开发者_运维问答ons of the mathematical equations in a program, but, I don't know exactly how to interpret them.
Thanks in advance.
Regards.
From my understanding there are only two methods to create derivative code automatically:
- forward differentiation
- backward differentiation
From what I understand backward differentiation is only academical, since it requires to remember the operations performed in an array and at the end walking back this array and interpreting the contents of this array. As a result (because of the interpretation) such code is very slow.
As far as I remember, the backward method has something to do with the chain rule.
It is also possible to mix both methods: If you have a piece of code:
a=f(b);
and the function f() is not trivial and b carries many derivatives, then it is helpful to calculate
a=f(b);
da_db=df(b);
da_dc=da_db*db_dc;
da_dd=da_db*db_dd;
精彩评论