[ADMB Users] recursive code

dave fournier davef at otter-rsch.com
Thu Jan 27 16:34:24 PST 2011


I do now!


DATA_SECTION
PARAMETER_SECTION
   init_number x
   objective_function_value f
PROCEDURE_SECTION
   dvariable u=myrec(x);
   f=square(u-.6);
GLOBALS_SECTION

   #include <admodel.h>
   int count=0;

   dvariable myrec(const prevariable& v)
   {
     if (count++>10)
       return sin(v);
     else
       return sin(myrec(v));
   }




More information about the Users mailing list