[ADOL-C] support for operator overloading for pdouble
Brad Bell
bradbell at seanet.com
Tue Aug 7 10:11:39 EDT 2018
A pdouble in ADOLC is like a dynamic parmaeter in CppAD see new_dynamic on
https://coin-or.github.io/CppAD/doc/new_dynamic.htm
I extended CppAD to allow for operations that only involve dynamic parameters; see the heading
08-04 on
https://coin-or.github.io/CppAD/doc/whats_new_18.htm
This was done by creating a separate and much simpler tape for the dynamic parameter operations; see
the variables
dyn_par_is_, dyn_par_op_, and dyn_par_op_ in the file
https://github.com/coin-or/CppAD/blob/master/cppad/local/recorder.hpp
On 02/28/2018 01:56 AM, hg wrote:
> 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
>
More information about the ADOL-C
mailing list