Automatic Differentiation for Matlab (ADiMat)

Automatic Differentiation for Matlab (ADiMat)

ADiMat is a software tool implementing the technology of automatic differentiation (AD) to programs written in MATLAB which is a trademark of The Mathworks, Inc. ADiMat is based on a source transformation approach. That is, it transforms a given MATLAB code for the evaluation of some mathematical function into a new MATLAB code for the evaluation of user-specified derivatives of that function.

The list of currently implemented features:

  • forward mode of AD,
    • first order derivative computation,
    • second order derivative computation in one pass (includes first order derivative computation),
  • reverse mode of AD
    • efficient computation of long gradients
    • specialized stacks for efficient I/O to the hard disk of large stacks
    • flexible recompute/storage trade-off
  • higher order derivatives by univariate Taylor coefficient propagation
  • Hessians and derivatives of Taylor coefficients by Taylor-over-reverse mode
  • most MATLAB language features recognized,
  • library of derivatives of many functions built into MATLAB,
    • extensible by user-defined derivatives of unknown or missing builtins
  • implements several classes to compute derivatives in vector mode,
  • code optimization of augmented code, and
  • support for GNU Octave.

Current limitations:

The MATLAB code to be differentiated has to fullfill some prerequisites:

  • No classes are allowed, i.e., ADiMat can not recognize MATLAB classes like the classes of the symbolic toolbox.
  • No eval() statement is allowed; the comand eval() evaluates a string of MATLAB instructions. The string may be composed at runtime so that its actual value is therefore not available at transformation time.
  • Some I/O functions (load, save, fscanf,…) are not completely supported and are flagged.

Besides the first item, all of the other restrictions can usually be circumvented by rewriting the corresponding code fragments. Do not hesitate to transform a code involving some of these concepts. We will do our best to help you.


The software is copyright and property of its authors at the Institute for Scientific Computing, TU Darmstadt, Germany and formerly the Institute for Scientific Computing, RWTH Aachen University, Germany.


ADiMat consists of two parts, a code transformation server and a runtime environment. The transformation server can be visited and used interactively at

The runtime environment may be obtained free of charge by downloading it from Currently, builds for architectures 32-bit Linux (GLNX32), 64-bit Linux (GLNXA64), Win32 (PCWIN) and Win64 (PCWIN64) are available. Source code of the adimat-client binary is available to support other operating systems like Mac OS X.

Referencing ADiMat:

C. H. Bischof, H. M. Bücker, B. Lang, A. Rasch, A. Vehreschild: Combining Source Transformation and Operator Overloading Techniques to Compute Derivatives for MATLAB Programs, Conference proceeding, Proceedings of the Second IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2002), IEEE Computer Society, 2002.

The corresponding BibTeX entry includes a direct link to the electronic version in its doi field.

More information:

For a quick introduction to ADiMat and how to use it you may read: