Elsevier Science Home
Computer Physics Communications Program Library
Full text online from Science Direct
Programs in Physics & Physical Chemistry
CPC Home

[Licence| Download | New Version Template] advi_v1_0.tar.gz(9 Kbytes)
Manuscript Title: ADF95: Tool for automatic differentiation of a FORTRAN code designed for large numbers of independent variables
Authors: Christian W. Straka
Program title: ADF95
Catalogue identifier: ADVI_v1_0
Distribution format: tar.gz
Journal reference: Comput. Phys. Commun. 168(2005)123
Programming language: FORTRAN 95.
Computer: all platforms with a FORTRAN 95 compiler.
Operating system: all platforms with a FORTRAN 95 compiler.
Keywords: Automatic differentiation, Derivatives, FORTRAN 95, Implicit Solvers.
PACS: 02.60.Jh.
Classification: 4.12, 4.14.

Nature of problem:
In many areas in the computational sciences first order partial derivatives for large and complex sets of equations are needed with machine precision accuracy. For example, any implicit or semi-implicit solver requires the computation of the Jacobian matrix, which contains the first derivatives with respect to the independent variables. ADF95 is a software module to facilitate the automatic computation of the first partial derivatives of any arbitrarily complex mathematical FORTRAN expression. The program exploits the sparsity inherited by many sets of equations thereby enabling faster computations compared to alternate differentiation tools.

Solution method:
A class is constructed which applies the chain rule of differentiation to any FORTRAN expression, to compute the first derivatives by forward differencing. An efficient indexing technique leads to a reduced memory usage and a substantially increased performance gain when sparsity can be exploited. From a users point of view, only minimal changes to his/her original code are needed in order to compute the first derivatives of any expression in the code.

Restrictions:
Processor and memory hardware may restrict both the possible number of independent variables and the computation time.

Unusual features:
ADF95 can operate on user code that makes use of the array features introduced in FORTRAN 90. A convenient extraction subroutine for the Jacobian matrix is also provided.

Running time:
In many realistic cases, the evaluation of the first order derivatives of a mathematical expression is only six times slower compared to the evaluation of analytically derived and hard-coded expressions. The actual factor depends on the underlying set of equations for which derivatives are to be calculated, the number of independent variables, the sparsity and on the FORTRAN 95 compiler.