<div dir="ltr">Thank you for your quick reply. I'm OK with the first construct.<br><div class="gmail_extra"><br></div><div class="gmail_extra">Best regards<br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Giang</div></div></div>
<br><div class="gmail_quote">On Wed, Feb 28, 2018 at 11:27 AM, Kshitij Kulshreshtha <span dir="ltr"><<a href="mailto:kshitij@math.uni-paderborn.de" target="_blank">kshitij@math.uni-paderborn.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
pdouble types are not meant to be added or multiplied together. One<br>
pdouble represents one actual parameter. If you combine parameters<br>
together, then you should either do that before converting them to<br>
pdoubles as simple doubles, and that combined value will then always be<br>
used, or the other possibility is to store the result of such a<br>
combination in a variable of type adouble, which you will use in the<br>
rest as any other adouble. The reason pdoubles cannot have overloaded<br>
operators is that we do not trace any operations on constants in order<br>
to keep the trace small, so these operations cannot be conducted when<br>
computing derivatives with such a trace.<br>
<br>
Your example should can either look like this:<br>
<span class=""><br>
const pdouble& __o_11_n = mkparam(input.o_11_n());<br>
const pdouble& __o_22_n = mkparam(input.o_22_n());<br>
const pdouble& __o_33_n = mkparam(input.o_33_n());<br>
<br>
</span>adouble __p_n = (adouble(__o_11_n) + __o_22_n + __o_33_n)/3;<br>
<br>
Then you can use __p_n wherever you need.<br>
<br>
Or it can look like this:<br>
<br>
const pdouble& __p_n =<br>
   mkparam( (input.o_11_n() + input.o_22_n() + input.o_33_n())/3);<br>
<br>
in case you only need __p_n in the rest of the code.<br>
<br>
Best wishes<br>
Kshitij Kulshreshtha.<br>
<div><div class="h5"><br>
On 02/28/18 10:56, hg wrote:<br>
> Dear Adol-C developers<br>
><br>
> I would like to report that the example taylor/inversexam.cpp failed<br>
> with ADOL-C release v2.6.3, but it worked with the developer version.<br>
> Hope the new stable release will be released soon.<br>
><br>
> Additionally I would like to request to add the operator overloading for<br>
> pdouble type. Because some material constants are formed from others and<br>
> it would lead to a neatly code if an immediate variable of type pdouble<br>
> is created. Right now I have to copy a lengthy expression to a lengthy<br>
> one, leading to quite a complicated expression, which is then hard to<br>
> debug if something happen later on.<br>
><br>
> Right now if I added the pdouble, the compilation error appears:<br>
><br>
> const pdouble& __o_11_n = mkparam(input.o_11_n());<br>
> const pdouble& __o_22_n = mkparam(input.o_22_n());<br>
> const pdouble& __o_33_n = mkparam(input.o_33_n());<br>
><br>
> pdouble __p_n = (__o_11_n + __o_22_n + __o_33_n)/3;<br>
><br>
><br>
> error: ambiguous overload for ‘operator+’ (operand types are ‘const<br>
> pdouble’ and ‘const pdouble’)<br>
>          pdouble __p_n = (__o_11_n + __o_22_n + __o_33_n)/3;<br>
>                                    ^<br>
> In file included from /home/hbui/opt/adol-c/include/<wbr>adolc/adouble.h:329:0,<br>
>                  from /home/hbui/opt/adol-c/include/<wbr>adolc/adolc.h:28,<br>
>                  from<br>
> /home/hbui/kratos_bcn2/<wbr>applications/soil_mechanics_<wbr>application/constitutive_laws/<wbr>smoothed_mohr_coulomb_ad_<wbr>explicit_lode_angle.cpp:18:<br>
> /home/hbui/opt/adol-c/include/<wbr>adolc/param.h:105:13: note: candidate:<br>
> adub operator+(const pdouble&, const badouble&)<br>
>  inline adub operator + ( const pdouble& a, const badouble& b)<br>
>              ^<br>
> In file included from /home/hbui/opt/adol-c/include/<wbr>adolc/param.h:58:0,<br>
>                  from /home/hbui/opt/adol-c/include/<wbr>adolc/adouble.h:329,<br>
>                  from /home/hbui/opt/adol-c/include/<wbr>adolc/adolc.h:28,<br>
>                  from<br>
> /home/hbui/kratos_bcn2/<wbr>applications/soil_mechanics_<wbr>application/constitutive_laws/<wbr>smoothed_mohr_coulomb_ad_<wbr>explicit_lode_angle.cpp:18:<br>
> /home/hbui/opt/adol-c/include/<wbr>adolc/internal/paramfunc.h:50:<wbr>34: note:<br>
> candidate: adub operator+(const badouble&, const pdouble&)<br>
>      friend ADOLC_DLL_EXPORT adub operator + ( const badouble&, const<br>
> pdouble&);<br>
><br>
><br>
> Best regards<br>
> Giang Bui<br>
><br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> ADOL-C mailing list<br>
> <a href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a><br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_adol-2Dc&d=DwIGaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=0eOhD1zcLnB9JhadNXrezwNw87TYLa0fyHrxCkWC5J8&m=YyhagFQmRBCP43JeHmTh1n3Xj3m8_3g63LF77CNcbkI&s=JnAlKZwjU7oHFylIbpcS7ANqQMH2bY3gCPzDo2ANArs&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__list.<wbr>coin-2Dor.org_mailman_<wbr>listinfo_adol-2Dc&d=DwIGaQ&c=<wbr>Ngd-<wbr>ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLx<wbr>WPA_2Wlc4&r=<wbr>0eOhD1zcLnB9JhadNXrezwNw87TYLa<wbr>0fyHrxCkWC5J8&m=<wbr>YyhagFQmRBCP43JeHmTh1n3Xj3m8_<wbr>3g63LF77CNcbkI&s=<wbr>JnAlKZwjU7oHFylIbpcS7ANqQMH2bY<wbr>3gCPzDo2ANArs&e=</a><br>
><br>
<br>
--<br>
PD. Dr. Kshitij Kulshreshtha<br>
<br>
Institut für Mathematik,<br>
Universität Paderborn,<br>
Warburger Straße 100,<br>
33098 Paderborn.<br>
<br>
Büro: TP21.1.21<br>
Besucheradresse:<br>
Technologiepark 21<br>
33098 Paderborn.<br>
<br>
Privatanschrift:<br>
Arnikaweg 62<br>
33100 Paderborn.<br>
______________________________<wbr>_________________<br>
ADOL-C mailing list<br>
<a href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_adol-2Dc&d=DwIGaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=0eOhD1zcLnB9JhadNXrezwNw87TYLa0fyHrxCkWC5J8&m=YyhagFQmRBCP43JeHmTh1n3Xj3m8_3g63LF77CNcbkI&s=JnAlKZwjU7oHFylIbpcS7ANqQMH2bY3gCPzDo2ANArs&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__list.<wbr>coin-2Dor.org_mailman_<wbr>listinfo_adol-2Dc&d=DwIGaQ&c=<wbr>Ngd-<wbr>ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLx<wbr>WPA_2Wlc4&r=<wbr>0eOhD1zcLnB9JhadNXrezwNw87TYLa<wbr>0fyHrxCkWC5J8&m=<wbr>YyhagFQmRBCP43JeHmTh1n3Xj3m8_<wbr>3g63LF77CNcbkI&s=<wbr>JnAlKZwjU7oHFylIbpcS7ANqQMH2bY<wbr>3gCPzDo2ANArs&e=</a> </blockquote></div><br></div></div>