[ADOL-C] Operations on passive adoubles? Nonsequential active adouble memory?
David.Seelbinder at dlr.de
David.Seelbinder at dlr.de
Mon May 12 16:04:01 EDT 2014
Dear all,
I have recently started to work with ADOL-C and I came across some unexpected behavior. Now I am wondering if I am doing something that is not allowed. I tried to reduce my problem to minimal size and describe it below. I would much appreciate any hints!
Problem setup:
I want to compute the sparse_hess(...) of a function
adouble Func(const vector<vector<adouble>& myContainer, double* otherArg)
But I am not interested in the hessian with respect to all values in myContainer, but only some subset.
So when I trace Func (...) I selectively set some of the adoubles active, e.g.:
double x[] = {1, 2, 3};
trace_on(tag);
myContainer[3][2] <<= x[0];
myContainer[1][2] <<= x[1];
myContainer[5][0] <<= x[2];
adouble result = Func(myContainer, ...otherArgs)
double result2;
result >>= result2;
trace_off();
int options[] = {0, 0};
double* rind = NULL;
double* cind = NULL;
double* val = NULL;
int nnz = 0;
sparse_hess(tag, 3, 0, x, &nnz, &rind, &cind, &val, options);
Problem description:
The problem occurs when I perform operations in Func on other adoubles than the ones I activated. E.g If Func contains
adouble dummy = myContainer[0][0] * myContainer[0][0];
This leads to a crash in sparse_hess->hess_pat->nonl_ind_forward_safe->traverse_unary
Uni5_for.c line 5622 if (tree->left != NULL)
Tree->left is undefined memory, probably because already in
Line 2016: traverse_unary(&fod[arg_index[arg1]], nonl_dom, &fod[arg_index[arg2]], indcheck+1,maxopind+2);
the index arg1 was wrong.
However, if I only perform operations on the activated adoubles in Func, the sparse_hess works fine!
That makes me wonder:
Questions:
1. I am doing something wrong, when using "passive" adoubles just as normal doubles?
2. Does ADOL-C require activated adoubles to be in sequential memory or fulfill other conditions?
3. Can adoubles be manipulated through pointers and references the same as normal doubles? What about the "const" ness of adouble arguments?
Any hints would be very welcome!
Kind regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20140512/1ade20e9/attachment.html>
More information about the ADOL-C
mailing list