<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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. <br>
<a class="moz-txt-link-freetext" href="http://www.coin-or.org/CppAD/Doc/sub_sparse_hes.cpp.xml">http://www.coin-or.org/CppAD/Doc/sub_sparse_hes.cpp.xml</a><br>
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. <br>
<br>
Note that one can use ADOLC at the lower level; i.e., use<br>
CppAD::AD< adouble ><br>
where adouble is the ADOLC type adouble; see<br>
<a class="moz-txt-link-freetext" href="http://www.coin-or.org/CppAD/Doc/mul_level_adolc.cpp.xml">http://www.coin-or.org/CppAD/Doc/mul_level_adolc.cpp.xml</a><br>
<br>
On 5/8/2015 3:49 PM, Leitz, Thomas wrote:<br>
</div>
<blockquote
cite="mid:%3CFC2CBD6FADFAB545A8A1BD731635DA21737B69D1@mbx1.exch.fau.de%3E"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=iso-8859-1">
<div>
<div>
<div>Hi,</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>2. mark only x as independent and tape the function with
any y0 every time before computing the gradient df/dx.</div>
<div><br>
</div>
<div>Is there any way to tape once, and later compute the
gradient df/dx at any (x0,y0) without retaping?</div>
<div><br>
</div>
<div><br>
</div>
<div>Thomas</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>