<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.E-MailFormatvorlage18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.E-MailFormatvorlage19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:763577198;
        mso-list-type:hybrid;
        mso-list-template-ids:1601608552 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Dear all,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I did more testing on the problem I described earlier. I made a minimum working example (see attachment), that causes the error.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">sparse_hess(&#8230;) crashes, when you perform operations on adoubles in the traced function which are not marked as independents.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">sparse_jac(&#8230;) does not show this behavior.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">David<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="punctuation-wrap:simple;text-autospace:none"><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<o:p></o:p></span></p>
<p class="MsoNormal" style="punctuation-wrap:simple;text-autospace:none"><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="punctuation-wrap:simple;text-autospace:none"><b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">Dipl. Inform. David Seelbinder</span></b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:16.0pt;punctuation-wrap:simple;text-autospace:none">
<a name="Telefon"></a><span lang="DE" style="font-size:8.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">Phone &#43;49 421 24420-1283 |
<a href="mailto:david.seelbinder@dlr.de">david.seelbinder@dlr.de</a><o:p></o:p></span></p>
<p class="MsoNormal" style="punctuation-wrap:simple;text-autospace:none"><b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray"><o:p>&nbsp;</o:p></span></b></p>
<p class="MsoNormal" style="punctuation-wrap:simple;text-autospace:none"><b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">Deutsches Zentrum für Luft- und Raumfahrt</span></b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">
 e.V. (DLR)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:16.0pt;punctuation-wrap:simple;text-autospace:none">
<a name="Institut"></a><span style="font-size:8.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">Institute of Space Systems| GNC Systems (RY-GNC) | Robert-Hooke-Str.
</span><span lang="DE" style="font-size:8.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:dimgray">7 | 28359 Bremen |
<a href="http://www.dlr.de/">www.DLR.de</a></span><u><span lang="DE" style="font-size:8.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:blue"><o:p></o:p></span></u></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">Von:</span></b><span lang="DE" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> adol-c-bounces@list.coin-or.org [mailto:adol-c-bounces@list.coin-or.org]
<b>Im Auftrag von </b>David.Seelbinder@dlr.de<br>
<b>Gesendet:</b> Montag, 12. Mai 2014 22:04<br>
<b>An:</b> adol-c@list.coin-or.org<br>
<b>Betreff:</b> [ADOL-C] Operations on passive adoubles? Nonsequential active adouble memory?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Dear all,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">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!<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><b>Problem setup: <o:p></o:p></b></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">I want to compute the sparse_hess(&#8230;) of a function <o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">adouble Func(<span style="color:blue">const</span> vector&lt;vector&lt;adouble&gt;&amp; myContainer,
<span style="color:blue">double</span>* otherArg)<o:p></o:p></span></p>
<p class="MsoNormal"><i><o:p>&nbsp;</o:p></i></p>
<p class="MsoNormal">But I am not interested in the hessian with respect to all values in &nbsp;<span style="font-size:9.5pt;font-family:Consolas">myContainer</span><i>,
</i>but only some subset.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">So when I trace <span style="font-size:9.5pt;font-family:Consolas">
Func</span><i> (&#8230;)</i> I selectively set some of the adoubles active, e.g.:<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">double x[] = {1, 2, 3};<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">trace_on(tag);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">myContainer[3][2] &lt;&lt;= x[0];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">myContainer[1][2] &lt;&lt;= x[1];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">myContainer[5][0] &lt;&lt;= x[2];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">adouble result = Func(myContainer, &#8230;otherArgs)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">double result2;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">result &gt;&gt;= result2;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">trace_off();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span style="font-size:9.5pt;font-family:Consolas"> options[] = {0, 0};<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">double* rind = NULL;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">double* cind = NULL;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">double* val&nbsp; = NULL;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">int nnz = 0;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">sparse_hess(tag, 3, 0, x, &amp;nnz, &amp;rind, &amp;cind, &amp;val, options);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b>Problem description: <o:p></o:p></b></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal">The problem occurs when I perform operations in Func on other adoubles than the ones I activated. E.g If Func contains<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">adouble dummy = myContainer[0][0] * myContainer[0][0];<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">This leads to a crash in sparse_hess-&gt;hess_pat-&gt;nonl_ind_forward_safe-&gt;traverse_unary<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="text-autospace:none">Uni5_for.c line 5622<span style="font-size:9.5pt;font-family:Consolas">&nbsp;
<span style="color:blue">if</span> (tree-&gt;left != NULL)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Tree-&gt;left is undefined memory, probably because already in<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">Line 2016: traverse_unary(&amp;fod[arg_index[arg1]], nonl_dom, &amp;fod[arg_index[arg2]], indcheck&#43;1,maxopind&#43;2);<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">the index arg1 was wrong. <o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">However, if I only perform operations on the activated adoubles in Func, the sparse_hess works fine!<o:p></o:p></p>
<p class="MsoNormal"><u><o:p><span style="text-decoration:none">&nbsp;</span></o:p></u></p>
<p class="MsoNormal">That makes me wonder:<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><b>Questions:<o:p></o:p></b></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>I am doing something wrong, when using &#8220;passive&#8221; adoubles just as normal doubles?<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>Does ADOL-C require activated adoubles to be in sequential memory or fulfill other conditions?<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">3.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>Can adoubles be manipulated through pointers and references the same as normal doubles? What about the &#8220;const&#8221; ness of adouble arguments?<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Any hints would be very welcome!<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Kind regards,<o:p></o:p></p>
<p class="MsoNormal">David<o:p></o:p></p>
</div>
</body>
</html>