[ADOL-C] Signature of Hessian driver

Kshitij Kulshreshtha kshitij at math.upb.de
Tue Sep 23 05:09:52 EDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Philipp,

yes, your construct is also what I'd personally do, cast away the
const-ness of the data. Unfortunately it isn't just a matter of adding
const in the hessian. The drivers call some low-level functions and
all these would need such appropriate const added. And the callability
from Fortran 77 and all the legacy code would be compromised.

But as I said the emphasis has always been on correctness. So even
without the const, you can rest assured that the data isn't changed.
If you copy the data before passing and compare it to the numerical
values after the driver call, you will see this. If the values do not
match, send me a small piece of code for testing.

Warm regards
Kshitij.

On 2014-09-23 11:01, Philipp Bender wrote:
> Dear Kshitij,
> 
> I did not come up with this because of code aesthetics :), more 
> because I integrate ADOL-C with an optimizer which asks me to
> evaluate the Hessian and gradient at a specific point, which is
> passed as const double*. So I help myself with this:
> 
> #ifdef DEBUG
> 
> std::vector< double > x_non_const(x, x+n); hessian(0, n,
> x_non_const.data(), Hess); // memory is equal, x_non_const has not
> been touched ... assert(std::memcmp(x_non_const.data(), x, n) ==
> 0);
> 
> #else
> 
> double* x_non_const = const_cast<double*>(x); hessian(0, n,
> x_non_const, Hess);
> 
> #endif
> 
> ... which works, but is not really the best construct ever. It
> should provide me with the confidence that the values never get
> touched, while being still efficient in release mode.
> 
> Best regards and thank you, Philipp 
> _______________________________________________ ADOL-C mailing
> list ADOL-C at list.coin-or.org 
> http://list.coin-or.org/mailman/listinfo/adol-c
> 

- -- 
Dr. Kshitij Kulshreshtha

Institut für Mathematik,
Universität Paderborn,
Warburger Straße 100,
33098 Paderborn.

Büro: A3.235

Privatanschrift:
Arnikaweg 62
33100 Paderborn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJUITjgAAoJEDWYtU3xIcMokksIALhKIZpMBcaByM+GLXfoOd/I
ivdf/B3q/M6Y6WLRjTcQz09uq+tkEOVsHJB/cu1x/dWzpG84b17/TUdjk/sbd8RO
jnSG2CvJqYDTP37RhroDruuL053n+uWBgfVSzdAjz8e5SwrCQuKAKyeJgvhJI2LI
jVGNgEzXuJVn4Dm1bWZGxyrCp6jZU/Jlnfm3LOJCSLAFiPZZ4oB2zj/Ek7pr5s/7
3ZDf9l1Dnglla44ZUVCl1TZTmtj7DoupMQbVEIqYORY9XdgUuN2CRoTIeVc4lqVy
vYCMHoppKyVvtAMi7cRHbE3d/cBFUmo2ibaAbWb4mRABoyIPQJwzip3J0ZR6tgc=
=4R46
-----END PGP SIGNATURE-----


More information about the ADOL-C mailing list