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

Brad Bell bradbell at seanet.com
Sat May 9 17:49:32 EDT 2015

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:
> Hi,
> 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?
> Thomas

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

More information about the ADOL-C mailing list