[ADOL-C] Operations on passive adoubles? Nonsequential active adouble memory?
kshitij at math.upb.de
Tue May 13 08:29:18 EDT 2014
there is no straightforward way to do this if you want to exploit
sparsity. However if you ignore sparsity, you can compute this using
hess_mat() which computes the product of the whole hessian with a given
The matrix you input will be a n times q matrix. Here n is the sum of
the dimentions of arg1 and arg2, and q is either the dimention of arg1,
or of arg2. If q = dim(arg1) then the top half of the input matrix is
the identity matrix otherwise the bottom half. Choose whichever value
for q is smaller. This will result in either left half of the hessian or
the right half of the hessian.
Trying to get just a quarter hessian in this manner is not efficient.
If you really need to exlpoit sparsity you will need to write your own
code. Ignore the following if this seems too complicated.
Basically you first use hess_pat to get the sparcity pattern for the
whole hessian. Then you edit it to only contain the part you need and
set everything else to zero. With this edited pattern you need to call
the graph-colouring routine in ColPack (see sparsedrivers.cpp
generate_seed_hess(...)). Once you have the seed, you need to call a
combination of fos_forward and hos_reverse to get the required
compressed jacobian (seed the implementation of sparse_hess() in
sparsedrivers.cpp) and then decompress it using ColPack routines.
As on 2014-05-13 13:55h, David.Seelbinder at dlr.de did write:
> Dear Kshitij,
> I do feel stupid now, and rightfully so. Sometimes it is just the thing you don’t expect that makes the difference. Thank you very much for your fast and helpful response.
> Please allow me to ask one more question:
> adouble Func(adouble* arg1, adouble* arg2)
> I want to compute the gradient of Func with respect to arg1. Then compute the jacobian of the gradient with respect to arg2. This should yield a 2nd order derivative sparse matrix with dimension size(arg1) x size(arg2).
> I thought about using sparse_hess with respect to arg1 and arg2 and then extract the required results, but as both are large, this is not a good solution.
> What would be the best way to do this with ADOL-C?
> Kind regards,
> -----Ursprüngliche Nachricht-----
> Von: adol-c-bounces at list.coin-or.org [mailto:adol-c-bounces at list.coin-or.org] Im Auftrag von Kshitij Kulshreshtha
> Gesendet: Dienstag, 13. Mai 2014 12:12
> An: adol-c at list.coin-or.org
> Betreff: Re: [ADOL-C] Operations on passive adoubles? Nonsequential active adouble memory?
> Dear David,
> The attached modified program works as you would expect. Please note the difference to your program.
> As on 2014-05-13 11:20h, David.Seelbinder at dlr.de did write:
>> Dear all,
>> I did more testing on the problem I described earlier. I made a
>> minimum working example (see attachment), that causes the error.
>> sparse_hess(…) crashes, when you perform operations on adoubles in the
>> traced function which are not marked as independents.
>> sparse_jac(…) does not show this behavior.
>> Kind regards,
> Dr. Kshitij Kulshreshtha
> Institut für Mathematik,
> Universität Paderborn,
> Warburger Straße 100,
> 33098 Paderborn.
> Büro: A3.235
> Arnikaweg 62
> 33100 Paderborn.
> ADOL-C mailing list
> ADOL-C at list.coin-or.org
Dr. Kshitij Kulshreshtha
Institut für Mathematik,
Warburger Straße 100,
More information about the ADOL-C