Prev  Next 
x
.
The mathematical form for the corresponding function is
@[@
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
).
Type
operation is an operation
that has a
Type
result and is not made up of
other more basic operations.
A sequence of atomic
Type
operations is called a
Type
operation sequence.
Given an C++ algorithm and its inputs,
there is a corresponding
Type
operation sequence for each type.
If
Type
is clear from the context,
we drop it and just refer to the operation sequence.
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 @)@ 