![]() |
Prev | Next |
\[
f(x) = 1 + x + x^2 / 2
\]
An algorithmic differentiation package
does not operate on the mathematical function
f(x)
but rather on the particular algorithm used to compute the function
(in this case exp_2.hpp
).
x^{(0)} \in \R^n
and it returns the corresponding vector
y^{(0)} \in \R^m
given by
\[
y^{(0)} = f( x^{(0)} )
\]
The superscript
(0)
denotes zero order derivative;
i.e., it is equal to the value
of the corresponding variable.
For the example we are considering here,
both
n
and
m
are equal to one.
We consider the case where exp_2.hpp
is executed with
x^{(0)} = .5
.
The table below contains the corresponding operation sequence
and the results of a zero order sweep.
Index |
| Code |
| Operation |
| Zero Order |
1 |
|
Type v1 = x;
|
v_1 = x
|
v_1^{(0)} = 0.5
| ||
2 |
|
Type v2 = Type(1) + v1;
|
v_2 = 1 + v_1
|
v_2^{(0)} = 1.5
| ||
3 |
|
Type v3 = v1 * v1;
|
v_3 = v_1 * v_1
|
v_3^{(0)} = 0.25
| ||
4 |
|
Type v4 = v3 / Type(2);
|
v_4 = v_3 / 2
|
v_4^{(0)} = 0.125
| ||
5 |
|
Type v5 = v2 + v4;
|
v_5 = v_2 + v_4
|
v_5^{(0)} = 1.625
|
\[
1.625 =
v_5^{(0)} =
f( x^{(0)} )
\]
x^{(0)} = .2
,
what is the result of a zero order forward sweep for
the operation sequence above;
i.e., what are the corresponding values for
\[
v_1^{(0)} , v_2^{(0)} , \cdots , v_5^{(0)}
\]