P. Hovland et al., EFFICIENT DERIVATIVE CODES THROUGH AUTOMATIC DIFFERENTIATION AND INTERFACE CONTRACTION - AN APPLICATION IN BIOSTATISTICS, SIAM journal on scientific computing, 18(4), 1997, pp. 1056-1066
Developing code for computing the first- and higher-order derivatives
of a function by hand can be very time consuming and is prone to error
s. Automatic differentiation has proven capable of producing derivativ
e codes with very little effort on the part of the user. Automatic dif
ferentiation avoids the truncation errors characteristic of divided di
fference approximations. However, the derivative code produced by auto
matic differentiation can be significantly less efficient than one pro
duced by hand. This shortcoming may be overcome by utilizing insight i
nto the high-level structure of a computation. This paper focuses on h
ow to take advantage of the fact that the number of variables passed b
etween subroutines frequently is small compared with the number of var
iables with respect to which one wishes to differentiate. Such an ''in
terface contraction,'' coupled with the associativity of the chain rul
e for differentiation, allows one to apply automatic differentiation i
n a more judicious fashion, resulting in much more efficient code for
the computation of derivatives, A case study involving the ADIFOR (Aut
omatic Differentiation of Fortran) tool and a program for maximizing a
logistic-normal likelihood function developed from a problem in nutri
tional epidemiology is examined, and performance figures are presented
.