<div dir="ltr">Thank you Brad for the answer, I thought of doing what you suggested, but I would later face the problem of having to manually trim the jacobian when I call the jacobian method of the adfun object, and also the extra computation not needed when computing the full jacobian, do you have any work around for this?<br><br>Best,</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 28, 2017 at 1:43 PM, Brad Bell <span dir="ltr"><<a href="mailto:bradbell@seanet.com" target="_blank">bradbell@seanet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div class="m_-9128972328210949939moz-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.<div><div class="h5"><br>
      <br>
          <br>
      <br>
      <br>
      <br>
      <br>
      On 06/28/2017 04:27 AM, Hilario Tomé wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      
      <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="m_-9128972328210949939gmail_signature">Hilario.<br>
        </div>
      </div>
      <br>
      <fieldset class="m_-9128972328210949939mimeAttachmentHeader"></fieldset>
      <br>
      </div></div><pre>______________________________<wbr>_________________
CppAD mailing list
<a class="m_-9128972328210949939moz-txt-link-abbreviated" href="mailto:CppAD@list.coin-or.org" target="_blank">CppAD@list.coin-or.org</a>
<a class="m_-9128972328210949939moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cppad&d=DwMDaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=GH3eJ7xA3ZBR9rQvT_fJhDgld4V8Nzy-5rXbR27Kb5c&m=1mBE6bNs5eNxiLDQVywSDTN4TIfnDxcxIe-wUHbDd80&s=sjbUY3bPGw7yzllPcFdDlP6RIXCLMUiM62_VWPzTCwU&e=" target="_blank">https://list.coin-or.org/<wbr>mailman/listinfo/cppad</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>______________________________<wbr>_________________<br>
CppAD mailing list<br>
<a href="mailto:CppAD@list.coin-or.org">CppAD@list.coin-or.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cppad&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=GH3eJ7xA3ZBR9rQvT_fJhDgld4V8Nzy-5rXbR27Kb5c&m=1mBE6bNs5eNxiLDQVywSDTN4TIfnDxcxIe-wUHbDd80&s=sjbUY3bPGw7yzllPcFdDlP6RIXCLMUiM62_VWPzTCwU&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__list.<wbr>coin-2Dor.org_mailman_<wbr>listinfo_cppad&d=DwICAg&c=Ngd-<wbr>ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLx<wbr>WPA_2Wlc4&r=GH3eJ7xA3ZBR9rQvT_<wbr>fJhDgld4V8Nzy-5rXbR27Kb5c&m=<wbr>1mBE6bNs5eNxiLDQVywSDTN4TIfnDx<wbr>cxIe-wUHbDd80&s=<wbr>sjbUY3bPGw7yzllPcFdDlP6RIXCLMU<wbr>iM62_VWPzTCwU&e=</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Hilario.<br></div>
</div>