Ian Washington washinid at mcmaster.ca
Tue May 20 17:21:56 EDT 2014

```Hello all,

I am new to the tapeless version of adol-c and I have a question related
to setting the number of directional derivatives (numdirs) when using
the forward vector mode.

In essence I would like to reset numdirs for a number of possibly
different Jacobian matrices.

For example, consider the following 'pseudo' code:

int main() {

// n = indep.
// m = dep.
// xinit = initial point
// gGraph = colpack via 'BipartiteGraphPartialColoringInterface'
// Seed_J = seed
// Jac_P = jac. pattern using 'jac_pat'
// nnz = nonzeros
// numdirs = directions

// preprocess to get Seed and Jac. pattern

ad_preprocess(n, m, xinit, &gGraph, &Seed_J, &Jac_P, &nnz, &numdirs);

// evaluate to get compressed Jac.

ad_evaluate(n, m, numdirs, xinit, Seed_J, &Jc);

// re-set everything and get a possibly new Jac.

ad_evaluate(n_n, m_n, numdirs_n, xinit_n, Seed_J_n, &Jc_n);

return 0;
}

( int n, int m, int numdirs, double *xinit,
double **Seed_J, double ***Jc_ret )
{

for (int i=0; i<n; i++) x[i] = xinit[i];

for (int i=0; i<n;++i) {
}

ceval_ad_tl(n, x, m, y); <-- evaluate functions

double **Jc = myalloc2(m, numdirs);

for (int i=0; i<m; i++){
for (int j=0; j<numdirs; j++)
}

*Jc_ret = Jc;

delete[] x;
delete[] y;
}

The problem with the above is when I reset numdirs using
adtl::setNumDir(numdirs_n) the second time I get the following:

ADOL-C Warning: Tapeless: Setting numDir will not change the number of
results or memory corruption

Note, if I just remove the second adtl::setNumDir(numdirs_n) and
evaluate the same Jacobian everything works fine.

So my question is how do I compute two different Jacobian matrices in
the same program, which have a different Seed and number of directional
derivatives?

Thanks,
Ian.

```