VFGEN
  • Home
  • Download
  • Support & FAQ
  • User's Guide
  • §   Vector Field File
  • §   ADOL-C
  • §   AUTO
  • §   Check
  • §   CVODE
  • §   DDE23
  • §   DDE-BIFTOOL
  • §   DDE_SOLVER
  • §   Delay2ODE
  • §   DSTool
  • §   EVF
  • §   GSL
  • §   Help
  • §   LaTeX
  • §   MATCONT
  • §   MATLAB
  • §   Octave
  • §   PyDSTool
  • §   PyGSL
  • §   RADAU5
  • §   Scilab
  • §   SciPy
  • §   Taylor
  • §   XPP

ADOL-C

ADOL-C implements automatic differentiation in C++.

The VFGEN ADOL-C Command

C++ files that can be used with ADOL-C are created by the command

$ vfgen adolc vector_field_file.vf

The files created are [name]_adolc.cpp and [name]_adolc.h, where [name] is the name of the vector field given in the vector field file. The C++ file [name]_adolc.cpp will contain the function

[name]_vf(short int tag, double *y_, double *f_, double *params_)

Example

Here is a sample vector field file: pendulum.vf.
The files created by
$ vfgen adolc pendulum.vf
are
  • pendulum_adolc.cpp
  • pendulum_adolc.h

As an example of how the pendulum_vf() function might be used, the program pend_solver.cpp implements a simple ODE solver with a fixed step size. A Makefile for this program is Makefile-pend_solver. The program can be compiled with the command

$ make -f Makefile-pend_solver
If ADOL-C is installed in a nonstandard directory, say, /opt/adolc, the following command can be used:
$ make CPPFLAGS=-I/opt/adolc/include LDFLAGS=-L/opt/adolc/lib -f Makefile-pend_solver
This will create the executable program called pend_solver, which can be run as follows:
$ ./pend_solver > pend7.dat
The following is a plot of the solution generated by pend_solver:

Copyright © 2005-2007 Warren Weckesser