[CppAD] Re: RombergOne issue

Brad Bell bradbell at seanet.com
Wed Nov 29 11:38:47 EST 2006


Thanks Kasper. I have modified
    CppAD/Romberg.h
to fix the problem.

In addition I have added
    test_more/romberg_one.cpp
which tests RombergOne using the floating point types:
    double, AD<double> and AD< AD<double> >.

These changes have been checked in as
    https://projects.coin-or.org/CppAD/changeset/664
and will be in the distribution files that are built tomorrow morning.


Kasper Kristensen wrote:

>Dear Brad,
>  
>
...

>I am having trouble using RombergOne with Float=AD<double>.
>The problem seems to be that the operation AD<double> - size_t is
>undefined.
>(Is this a compiler specific issue - could someone please try to
>compile the attached code sample?)
>I used the following quick fix:
>diff RombergOne.h RombergOne.h.old
>185c185
><                       x    = ( (pow2 - int(k)) * a + k * b ) / pow2;
>---
>  
>
>>                      x    = ( (pow2 - k) * a + k * b ) / pow2;
>>    
>>
>
>Or would a change to the macro CppADFoldBinaryOperator be better?
>
>Best wishes
>Kasper
>
>
>CODE SAMPLE (works only with Type=double):
>
>#include <CppAD/CppAD.h>
>using namespace CppAD;
>template <class Type>
>class Fun{
>public:
>  Type a,b,e;
>  size_t n,p;
>  Fun(){}
>  Type operator()(const Type &x){return x;}
>};
>int main(){
>  //Fun<double > F;
>  Fun<AD<double> > F;
>  RombergOne(F,F.a,F.b,F.n,F.p,F.e);
>}
>
>
>
>
>  
>



More information about the CppAD mailing list