<HTML>
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="OPENWEBMAIL" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>

<font size="2">Notation:
<br />Using your notation below we define
<br />        z = f(x, y)
<br />where x, y, z are vectors of length nx, ny, and nz respectively.
<br />Furthermore nx ~= ny ~= 2 * nz (where ~= means approximately equal).
<br />
<br />Answer to Q2 below:
<br />If you are only interested in computing partials with respect to x, it is more efficient to treat y as parameters (not variables) and declare x to the be the vector of independent variables.
<br />
<br />Answer to Q1 below:
<br />Thus, and with an abuse of notation,
<br />        z = f(x)
<br />When computing the derivative of this function, the Jacobian driver
<br />        http://www.coin-or.org/CppAD/Doc/jacobian.xml
<br />will use reverse mode because nz &lt; nx. This is not clear from the documentation (and I will fix that).  If you look at near the end of
<br />https://projects.coin-or.org/CppAD/browser/trunk/cppad/local/jacobian.hpp
<br />you will see that the Jacobian driver tries to use either forward or reverse mode depending on which is more efficient.
<br />
<br />Answer to Q3 below:
<br />CppAD requests memory in large blocks, and tries reduce the number of times it preforms such requests (while still being efficient about handing memory back to the system). The time to compute your Jacobians should not increase as more and more Jacobians are computed (CppAD should not cause memory to become fragmented).
<br />
<br /><b>On Thu, 8 Jan 2009 15:47:34 +0100, Lars Struen Imsland wrote</b>
<br />&gt; In 
my problem, I have a function z = f(x,y), for which 
I
need the Jacobian wrt x, \frac{\partial f}{\partial x}. This Jacobian will 
be
evaluated many times, for varying x and y. Typical dimensions are 2 n_z 
\approx
n_x \approx n_y \approx 
100.<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; I have implemented this using the Jacobian driver with x 
as
independent variable. I understand the Jacobian driver uses forward 
mode.<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; Q1: Will it be more efficient to use some reverse 
mode/driver
(since n_z is smaller than 
n_x)?<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; Presently, I retape the operations before each call to 
the
Jacobian, since y 
varies.<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; Q2: Will it be more efficient to do only one taping with 
x
and y as independent variables, and just pick out the relevant columns of 
the
Jacobian?<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; A more general 
question:<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; Q3: Since I will calculate the Jacobian _<i>many</i>_ 
times
(presently with retaping of the operations), should I worry about 
memory
fragmentation?<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; So far, CppAD seems to work splendidly, and is very easy 
to
use. Many thanks to the 
developers.<o:p />

<br />&gt; <o:p> 
</o:p>

<br />&gt; 
TIA,<o:p />

<br />&gt; 
Lars<o:p />

<br />
<br />
</font>
</BODY>
</HTML>