[ADOL-C] support for operator overloading for pdouble

hg hgbk2008 at gmail.com
Wed Feb 28 04:56:23 EST 2018


Dear Adol-C developers

I would like to report that the example taylor/inversexam.cpp failed with
ADOL-C release v2.6.3, but it worked with the developer version. Hope the
new stable release will be released soon.

Additionally I would like to request to add the operator overloading for
pdouble type. Because some material constants are formed from others and it
would lead to a neatly code if an immediate variable of type pdouble is
created. Right now I have to copy a lengthy expression to a lengthy one,
leading to quite a complicated expression, which is then hard to debug if
something happen later on.

Right now if I added the pdouble, the compilation error appears:

const pdouble& __o_11_n = mkparam(input.o_11_n());
const pdouble& __o_22_n = mkparam(input.o_22_n());
const pdouble& __o_33_n = mkparam(input.o_33_n());

pdouble __p_n = (__o_11_n + __o_22_n + __o_33_n)/3;


error: ambiguous overload for ‘operator+’ (operand types are ‘const
pdouble’ and ‘const pdouble’)
         pdouble __p_n = (__o_11_n + __o_22_n + __o_33_n)/3;
                                   ^
In file included from /home/hbui/opt/adol-c/include/adolc/adouble.h:329:0,
                 from /home/hbui/opt/adol-c/include/adolc/adolc.h:28,
                 from
/home/hbui/kratos_bcn2/applications/soil_mechanics_application/constitutive_laws/smoothed_mohr_coulomb_ad_explicit_lode_angle.cpp:18:
/home/hbui/opt/adol-c/include/adolc/param.h:105:13: note: candidate: adub
operator+(const pdouble&, const badouble&)
 inline adub operator + ( const pdouble& a, const badouble& b)
             ^
In file included from /home/hbui/opt/adol-c/include/adolc/param.h:58:0,
                 from /home/hbui/opt/adol-c/include/adolc/adouble.h:329,
                 from /home/hbui/opt/adol-c/include/adolc/adolc.h:28,
                 from
/home/hbui/kratos_bcn2/applications/soil_mechanics_application/constitutive_laws/smoothed_mohr_coulomb_ad_explicit_lode_angle.cpp:18:
/home/hbui/opt/adol-c/include/adolc/internal/paramfunc.h:50:34: note:
candidate: adub operator+(const badouble&, const pdouble&)
     friend ADOLC_DLL_EXPORT adub operator + ( const badouble&, const
pdouble&);


Best regards
Giang Bui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20180228/0646640c/attachment.html>


More information about the ADOL-C mailing list