[ADOL-C] Change parameters of a function without retaping

Leitz, Thomas thomas.leitz at fau.de
Fri May 15 05:35:04 EDT 2015

Hi Brad,

Thanks for your reply. I'm not (yet) familiar with CppAD, but since I'm currently trying to figure out which of all the autodiff-packages to use for my project, it is good to know, that what I'm trying to do is possible with CppAD. It is also nice to know, that a combination of ADOL-C and CppAD is easy.


Thomas Leitz
Chair of Applied Dynamics
University of Erlangen-Nuremberg
Haberstrasse 1
D-91058 Erlangen, Germany
room 01.012
phone +49 (0)9131 85 61005

On 09.05.2015, at 23:49, Brad Bell <bradbell at seanet.com<mailto:bradbell at seanet.com>> wrote:

The following example demonstrates having a Sparse Hessian w.r.t. one set of variables and parameters (in the sense below) with respect to another set of variables.
It makes use of the fact that CppAD allows for AD< AD<double> >.  I think that this example could be modified to accomplish your goal below.

Note that one can use ADOLC at the lower level; i.e., use
    CppAD::AD< adouble >
where adouble is the ADOLC type adouble; see

On 5/8/2015 3:49 PM, Leitz, Thomas wrote:

lets assume I have a function f(x,y) : R^n \times R^m -> R and I only need the gradient with respect to x, but every time I need to change both variables x and y. (y could be some parameters like coefficients of a polynomial function etc.). There are basically two ways I know how to achieve this:

1. mark both x and y as independent variables, tape once and every time I need a gradient I compute the whole gradient df/d(x,y) at some (x0,y0) and just use df/dx (i.e. the first n values of the gradient df/d(x,y)). This way I can change both variables but I also compute the gradient df/dy that I don't need.

2. mark only x as independent and tape the function with any y0 every time before computing the gradient df/dx.

Is there any way to tape once, and later compute the gradient df/dx at any (x0,y0) without retaping?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20150515/d631946d/attachment.html>

More information about the ADOL-C mailing list