# The Art of Differentiating Computer Programs

SIAM Book: The Art of Differentiating Computer Programs

SIAM website

## Errata

• Preface, page xiii: website of this book is www.siam.org/books/se24 (not .../se22)
• Algorithm 1.8, line 2: y on left-hand side of assigment should be non-bold
• Fig. 2.15 shows reversal scheme R_2 instead of optimal R_5
• Exercise 2.4.5.: In 1., y should be initialized to 1 (not to 0) in g
• Algorithm 1.9, line 9: should be x (instead of \tilde{x}) on the right-hand side of the assignment; got it right in line 7 of Algorithm 1.5 ...
• page 224, code listing, line 31: should be f_restore_results (instead of f_store_results)
• page 105; third line from below: should be x_{(1)}^{(2)} \equiv ... (instead of x^{(2)} \equiv ...)
• page 33, listing of h_cfd, line 9: should be xp[i]+=h (instead of xp[i]+=+h)
• page 44, listing of t1_f, second line: should be t1_v1 (instead of t1_v3)
• page 59, listing of a1_f after optimization, last line: should be a1_y[0]=0 (instead of a1_y[1]=0)
• page 60, signature of a1_f: should be double &a1_x (instead of double *a1_f)
• Example 3.19, page 112: adjoint statement for y=0 is missing; insert a1_y=0 as last line
• Figure 2.9, page 75, caption: should be second and third columns (instead of third and fourth)
• Listing 2.2, page 74 shows the adjoint driver that was used to time n executions of the adjoint code for comparison with the same number of executions of the original code in order to compute the cost ratio. The correct driver for the evaluation of the gradient is the following:
#include
#include "dco_a1s_type.hpp"
using namespace std;

const int n=4;

extern dco_a1s_tape_entry dco_a1s_tape[DCO_A1S_TAPE_SIZE];

void f(dco_a1s_type *x, dco_a1s_type &y) {
y=0;
for (int i=0;i<n;i++) y=y+x[i]*x[i];
y=y*y;
}

int main() {
dco_a1s_type x[n], y;
for (int i=0;i<n;i++) x[i]=1;
f(x,y);
dco_a1s_tape[y.va].a=1;
dco_a1s_interpret_tape();
for (int i=0;i<n;i++)
cout << i << "\t" << dco_a1s_tape[x[i].va].a << endl;
return 0;
}

Line references in the associated text need to be adapted accordingly.
• Appendix B.2, page 259: end of second line should be or (instead of and/or)