[ADOL-C] Multidimensional array

Andrea Walther awalther at math.uni-paderborn.de
Sun Aug 15 06:35:33 EDT 2010


Hi,

>
>    I have a question about adouble class. Are dynamic multidimensional
> array's

  valid as adouble ?

yes, but you have to use the new operator to allocate the
memory. I.e., instead of
>
>
>   adouble** u = (adouble**)malloc(nfe*sizeof(adouble**));
>   for(i = 0; i<nfe; i++)
>     u[i] = (adouble*)malloc(m*sizeof(adouble*));
>

one should use

adouble** u = new adouble*[nfe];
for(i = 0; i<nfe; i++)

   u[i] = new adouble[m]

best,

Andrea

-- 
Prof. Dr. Andrea Walther
Lehrstuhl fuer Mathematik und ihre Anwendungen
Institut fuer Mathematik
Universitaet Paderborn
Warburger Str. 100
33098 Paderborn

Email: andrea.walther at uni-paderborn.de
Phone: ++49 5251 602721
        ++49 5251 602724 (sekr.)
Fax:   ++49 5251 603728

**********





More information about the ADOL-C mailing list