<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 06/28/2017 04:51 AM, Hilario Tomé
      wrote:<br>
    </div>
    <blockquote
cite="mid:CACOjP-aCwTUMkzYNYH+dEEBb6oZZwJjWBv0kS8VwcShY4aT0kA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <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>
      </div>
    </blockquote>
    <br>
    In the sparse case, you specify which elements of the Jacobian to
    calculate; see subset on<br>
        <a class="moz-txt-link-freetext" href="https://www.coin-or.org/CppAD/Doc/sparse_jac.htm#subset">https://www.coin-or.org/CppAD/Doc/sparse_jac.htm#subset</a><br>
    <br>
    In the dense matrix case, and reverse mode, there is very little
    extra work for computing derivatives w.r.t. extra variables. In the
    dense case and forward mode, there is no need to include the extra
    variable during the forward passes for the Jacobian. For this case,
    think of the function JacobianFor in<br>
       
    <a class="moz-txt-link-freetext" href="https://github.com/coin-or/CppAD/blob/master/cppad/core/jacobian.hpp">https://github.com/coin-or/CppAD/blob/master/cppad/core/jacobian.hpp</a><br>
    as an example of how to compute the Jacobian and just exclude the
    constant for the set of variables you are computing the paritals
    w.r..t<br>
    <br>
    <blockquote
cite="mid:CACOjP-aCwTUMkzYNYH+dEEBb6oZZwJjWBv0kS8VwcShY4aT0kA@mail.gmail.com"
      type="cite">
      <div dir="ltr"><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 moz-do-not-send="true"
              href="mailto:bradbell@seanet.com" target="_blank">bradbell@seanet.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote">
            <div>
              <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 moz-do-not-send="true" class="m_-9128972328210949939moz-txt-link-abbreviated" href="mailto:CppAD@list.coin-or.org" target="_blank">CppAD@list.coin-or.org</a>
<a moz-do-not-send="true" 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>
    

  </div>


______________________________<wbr>_________________

CppAD mailing list

<a moz-do-not-send="true" href="mailto:CppAD@list.coin-or.org">CppAD@list.coin-or.org</a>

<a moz-do-not-send="true" 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>


</blockquote></div>

<div>
</div>-- 
<div class="gmail_signature" data-smartmail="gmail_signature">Hilario.
</div>
</div>



</blockquote>
</body></html>