skip to main content
article

An efficient overloaded implementation of forward mode automatic differentiation in MATLAB

Published:01 June 2006Publication History
Skip Abstract Section

Abstract

The Mad package described here facilitates the evaluation of first derivatives of multidimensional functions that are defined by computer codes written in MATLAB. The underlying algorithm is the well-known forward mode of automatic differentiation implemented via operator overloading on variables of the class fmad. The main distinguishing feature of this MATLAB implementation is the separation of the linear combination of derivative vectors into a separate derivative vector class derivvec. This allows for the straightforward performance optimization of the overall package. Additionally, by internally using a matrix (two-dimensional) representation of arbitrary dimension directional derivatives, we may utilize MATLAB's sparse matrix class to propagate sparse directional derivatives for MATLAB code which uses arbitrary dimension arrays. On several examples, the package is shown to be more efficient than Verma's ADMAT package [Verma 1998a].

References

  1. Berz, M., Bischof, C., Corliss, G., and Griewank, A., Eds. 1996. Computational Differentiation: Techniques, Applications, and Tools. SIAM, Philadelphia, PA.Google ScholarGoogle Scholar
  2. Bischof, C., Bücker, H., Lang, B., Rasch, A., and Vehreschild, A. 2002. Combining source transformation and operator overloading techniques to compute derivatives for MATLAB programs. In Proceedings of the 2nd IEEE International Workshop on Source Code Analysis and Manipulation (SCAM'02). IEEE Computer Society, 65--72. Google ScholarGoogle Scholar
  3. Bischof, C., Lang, B., and Vehreschild, A. 2003. Automatic differentiation for MATLAB programs. In Proceedings in Applied Mathematics and Mechanics 2, 1 John Wiley, 50--53.Google ScholarGoogle Scholar
  4. Bischof, C. H., Carle, A., Khademi, P., and Mauer, A. 1996. ADIFOR 2.0: Automatic differentiation of Fortran 77 programs. IEEE Computa. Science Engin. 3, 3, 18--32. Google ScholarGoogle Scholar
  5. Bischof, C. H., Khademi, P. M., Bouaricha, A., and Carle, A. 1996. Efficient computations of gradients and Jacobians by dynamic exploitation of sparsity in automatic differentiation. Optimiz. Meth. Softw. 7, 1--39.Google ScholarGoogle Scholar
  6. Bischof, C. H., Roh, L., and Mauer, A. 1997. ADIC---An extensible automatic differentiation tool for ANSI-C. Softw.---Pract. Exper. 27, 12, 1427--1456. www-fp.mcs.anl.gov/adic/. Google ScholarGoogle Scholar
  7. Borggaard, J. and Verma, A. 2000. On efficient solutions to the continuous sensitivity equation using automatic differentiation. SIAM J. Sci. Comput. 22, 1, 39--62. Google ScholarGoogle Scholar
  8. Bradshaw, D. 2004. The use of numerical optimisation to determine on-limit handling behaviour of race cars. Ph.D. thesis, School of Engineering, Department of Automotive, Mechanical and Structural Engineering, Cranfield University, Bedfordshire, UK.Google ScholarGoogle Scholar
  9. Coleman, T. F. and Verma, A. 1996. Structure and efficient Jacobian calculation. In Computational Differentiation: Techniques, Applications, and Tools, M. Berz, C. Bischof, G. Corliss, and A. Griewank, Eds. SIAM, Philadelphia, PA, 149--159.Google ScholarGoogle Scholar
  10. Coleman, T. F. and Verma, A. 1998a. ADMAT: An automatic differentiation toolbox for MATLAB. Tech. rep., Computer Science Department, Cornell University. Google ScholarGoogle Scholar
  11. Coleman, T. F. and Verma, A. 1998b. The efficient computation of sparse Jacobian matrices using automatic differentiation. SIAM J. Sci. Comput. 19, 4, 1210--1233. Google ScholarGoogle Scholar
  12. Coleman, T. F. and Verma, A. 2000. ADMIT-1: Automatic differentiation and MATLAB interface toolbox. ACM Trans. Math. Softw. 26, 1 (March) 150--175. Google ScholarGoogle Scholar
  13. Corliss, G., Faure, C., Griewank, A., Hascoët, L., and Naumann, U., Eds. 2001. Automatic Differentiation: From Simulation to Optimization. Computer and Information Science. Springer, New York, NY. Google ScholarGoogle Scholar
  14. FastOpt 2003. Transformation of Algorithms in Fortran, Manual, Draft Version, TAF Version 1.6. FastOpt. http://www.FastOpt.com/taf.Google ScholarGoogle Scholar
  15. Forth, S. A. 2001. User guide for MAD---a Matlab automatic differentiation toolbox. Applied Mathematics and Operational Research Report AMOR 2001/5 (June) Cranfield University (RMCS Shrivenham), Swindon, UK.Google ScholarGoogle Scholar
  16. Forth, S. A. and Edvall, M. M. 2004. User Guide for MAD - MATLAB Automatic Differentiation Toolbox TOMLAB/MAD, Version 1.1 The Forward Mode. TOMLAB Optimization Inc., San Diego, CA. http://tomlab.biz/products/mad.Google ScholarGoogle Scholar
  17. Forth, S. A. and Ketzscher, R. 2004. High-level interfaces for the MAD (Matlab Automatic Differentiation) package. In 4th European Congress on Computational Methods in Applied Sciences and Engineering (ECCOMAS), P. Neittaanmäki, T. Rossi, S. Korotov, E. Oñate, J. Périaux, and D. Knörzer, Eds. Vol. 2. University of Jyväskylä, Department of Mathematical Information Technology, Finland.Google ScholarGoogle Scholar
  18. Forth, S. A., Tadjouddine, M., Pryce, J. D., and Reid, J. K. 2004. Jacobian code generated by source transformation and vertex elimination can be as efficient as hand-coding. ACM Trans. Math. Softw. 30, 3 (Sep.) 266--299. http://doi.acm.org/10.1145/1024074.1024076. Google ScholarGoogle Scholar
  19. Gilbert, J. R., Moler, C., and Schreiber, R. 1992. Sparse matrices in MATLAB: Design and implementation. SIAM J. Matrix Analy. Appl. 13, 1 (Jan.), 333--356. Google ScholarGoogle Scholar
  20. Griewank, A. 2000. Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation. Frontiers in Applied Mathematics, No. 19. SIAM, Philadelphia, PA. Google ScholarGoogle Scholar
  21. Griewank, A., Juedes, D., and Utke, J. 1996. Algorithm 755: ADOL--C, a package for the automatic differentiation of algorithms written in C/C++. ACM Trans. Math. Softw. 22, 2, 131--167. Google ScholarGoogle Scholar
  22. Griewank, A. and Reese, S. 1991. On the calculation of Jacobian matrices by the Markowitz rule. In Automatic Differentiation of Algorithms: Theory, Implementation, and Application, A. Griewank and G. F. Corliss, Eds. SIAM, Philadelphia, PA, 126--135.Google ScholarGoogle Scholar
  23. Hairer, E. and Wanner, G. 1991. Ordinary Differential Equations II, Stiff and Differential-Algebraic Problems. Springer-Verlag, Berlin, Germany.Google ScholarGoogle Scholar
  24. Holmström, K. and Edvall, M. M. January 2004. Chapter 19: The TOMLAB optimization environment. In Modeling Languages in Mathematical Optimization, J. Kallrath, Ed. APPLIED OPTIMIZATION 88. Kluwer Academic Publishers, Boston, MA.Google ScholarGoogle Scholar
  25. Holmström, K., Göran, A. O., and Edvall, M. M. 2004. User's guide for TOMLAB 4.3. TOMLAB Optimization Inc., San Diego, CA. http://www.tomlab.biz.Google ScholarGoogle Scholar
  26. Kharche, R. V. 2004. Source transformation for automatic differentiation in MATLAB. M.S. thesis, Cranfield University (Shrivenham Campus), Applied Mathematics & Operational Research Group, Engineering Systems Department (RMCS Shrivenham), Swindon, UK. Google ScholarGoogle Scholar
  27. Naumann, U. 1999. Efficient calculation of Jacobian matrices by optimized application of the chain rule to computational graphs. Ph.D. thesis, Technical University of Dresden.Google ScholarGoogle Scholar
  28. Naumann, U. 2004. Optimal accumulation of Jacobian matrices by elimination methods on the dual computational graph. Math. Program. 99, 3 (April), 399--421. Google ScholarGoogle Scholar
  29. Nocedal, J. and Wright, S. J. 1999. Numerical Optimization. Operational Research Series. Springer-Verlag, New York, NY.Google ScholarGoogle Scholar
  30. Pryce, J. D. and Reid, J. K. 1998. ADO1, a Fortran 90 code for automatic differentiation. Tech. Rep. RAL-TR-1998-057, Rutherford Appleton Laboratory, Chilton, UK. ftp://matisa.cc.rl.ac.uk/ pub/reports/prRAL98057.ps.gz.Google ScholarGoogle Scholar
  31. Rich, L. C. and Hill, D. R. 1992. Automatic differentiation in MATLAB. App. Num. Math. 9, 33--43. Google ScholarGoogle Scholar
  32. Ringrose, T. J. and Forth, S. A. 2002. Improved fitting of constrained multivariate regression models using automatic differentiation. In Proceedings in Computational Statistics, 15th Symposium (COMPSTAT'02), W. Hardle and B. Ronz, Eds. Physica-Verlag, Berlin, Germany, 383--388.Google ScholarGoogle Scholar
  33. Ringrose, T. J. and Forth, S. A. 2005. Simplifying multivariate second order response surfaces by fitting constrained models using automatic differentiation. Technometrics 47, 3, 249--259.Google ScholarGoogle Scholar
  34. Shampine, L. and Reichelt, M. 1997. The MATLAB ODE suite. SIAM J. Sci. Comput. 18, 1--22. Google ScholarGoogle Scholar
  35. Shampine, L. F., Ketzscher, R., and Forth, S. A. 2005. Using AD to solve BVPs in MATLAB. ACM Trans. Math. Softw. 31, 1 (March), 79--94. Google ScholarGoogle Scholar
  36. Tadjouddine, M., Forth, S. A., and Pryce, J. D. 2001. AD tools and prospects for optimal AD in CFD flux Jacobian calculations. In Automatic Differentiation: From Simulation to Optimization, G. Corliss, C. Faure, A. Griewank, L. Hascoët, and U. Naumann, Eds. Computer and Information Science. Springer, New York, NY, 247--252. Google ScholarGoogle Scholar
  37. Tapenade 2003. The TAPENADE tutorial. http://www-sop.inria.fr/tropics/tapenade/ tutorial.html.Google ScholarGoogle Scholar
  38. The MathWorks Inc. 2003. Using Matlab, Version 6. The MathWorks Inc., MA.Google ScholarGoogle Scholar
  39. The Mathworks Inc. Sept 2003. Optimization Toolbox User's Guide, Version 2. The Mathworks Inc., Natick MA.Google ScholarGoogle Scholar
  40. Vehreschild, A. 2001. Semantic augmentation of MATLAB programs to compute derivatives. Diploma Thesis, Institute for Scientific Computing, Aachen University, Germany.Google ScholarGoogle Scholar
  41. Verma, A. 1998a. ADMAT: Automatic differentiation in MATLAB using object oriented methods. In SIAM Interdisciplinary Workshop on Object Oriented Methods for Interoperability. SIAM, National Science Foundation, Yorktown Heights, New York, 174--183.Google ScholarGoogle Scholar
  42. Verma, A. 1998b. Structured automatic differentiation. Ph.D. thesis. Department of Computer Science, Cornell University, Ithaca, NY. Google ScholarGoogle Scholar

Index Terms

  1. An efficient overloaded implementation of forward mode automatic differentiation in MATLAB

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in

                Full Access

                • Published in

                  cover image ACM Transactions on Mathematical Software
                  ACM Transactions on Mathematical Software  Volume 32, Issue 2
                  June 2006
                  205 pages
                  ISSN:0098-3500
                  EISSN:1557-7295
                  DOI:10.1145/1141885
                  Issue’s Table of Contents

                  Copyright © 2006 ACM

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 June 2006
                  Published in toms Volume 32, Issue 2

                  Permissions

                  Request permissions about this article.

                  Request Permissions

                  Check for updates

                  Qualifiers

                  • article

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader