<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">I would try the following approach:<br>
<br>
Use c (or any other name) to denote the constant (a scalar) and
let n be the length of the vector x.<br>
Then do the following;<br>
Vector< AD<double> > a_xc(n+1);<br>
for(size_t j = 0; j < n; j++)<br>
a_xc[j] = x[j];<br>
a_xc[n] = c; <br>
Independent( a_xc );<br>
Vector< AD<double> > a_x(n);<br>
AD<double> a_c;<br>
for(size_t j = 0; j < n; j++)<br>
a_x[j] = a_xc[j];<br>
a_c = a_xc[n];<br>
In other words make c a variable. That way you can change is value
when computing derivatives.<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 06/28/2017 04:27 AM, Hilario Tomé wrote:<br>
</div>
<blockquote
cite="mid:CACOjP-bRKWQbHSY2u7Lyi-y+4gPXqpWi3bXiP11p6WO1hgOyyQ@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
<div dir="ltr">
<p dir="ltr"><span>Dear all,</span></p>
<p dir="ltr"> </p>
<p dir="ltr"><span>I would like to know if it's possible to
record a pointer to an external value in the tape. The use
case is to have formulas like y = constant*x. Once the ADfun
object is created if I change the value of constant I have
to retape right now, and sometimes the re-taping operation
is to costly, especially if sparsity operations are
involved.</span></p>
<p dir="ltr"> </p>
<p dir="ltr"><span>Best,</span></p>
<div><br>
</div>
-- <br>
<div class="gmail_signature">Hilario.<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
CppAD mailing list
<a class="moz-txt-link-abbreviated" href="mailto:CppAD@list.coin-or.org">CppAD@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="https://list.coin-or.org/mailman/listinfo/cppad">https://list.coin-or.org/mailman/listinfo/cppad</a>
</pre>
</blockquote>
<br>
</body>
</html>