[ADMB Users] bug in file f1b2vc1

dave fournier otter at otter-rsch.com
Thu Aug 6 08:29:46 PDT 2009

Thanks Ben you found a fatal bug. Hard to believe that function had
never been used before. In the file f1b2vc1.cpp
the line


should have been


df1b2vector operator + (const dvector& _x,const df1b2vector& _y)
   check_shape(x,y,"operator +");

   int mmin=x.indexmin();
   int mmax=x.indexmax();
   df1b2vector tmp;

   for (int i=mmin;i<=mmax;i++)
   return tmp;

Sorry for that.  The reason for these stupid errors is that every once
and a while the  compiler police for the various c++ compilers make
changes that break huge amount of old code so one has to fix it all at
one go and these sorts of errors  creep in.

Maybe someone can comment on how this can get fixed quickly.

as for just hoping that prob will remain between 0 and 1 -- that is a
mugs game. It will break at the most inopportune time. I modifed your
code to put in the bounds. also you need to include the prior for the u's

Finally WRT yuo commentabout initial values for the u's being necessary.
that is inaccurate. default values are provided for all parameters.
However if you want to supply a *.pin ifle then it must include values
for all parameters. I have already commented on the easiest way to
produce such a *.pin file.

Herre is your code as I have modified it.

 //cout << "cvec calc\n";
 cvec = sigma_c*(Z*u)+c;
 a1vec = elem_prod(pow(size/d,g),exp(-size/d));
 //cout << "prob calc\n";
 prob = 1/(1/(elem_prod(cvec,a1vec))+h*initial);

 dvariable ppen=0.0;
 dvar_vector pprob=posfun(prob,0.01,ppen);


 dvar_vector pprob2=1.0-posfun(1.0-pprob,0.01,ppen);


 f+=0.5*norm2(u);  // prior

 f -= sum( log_comb(initial,killed)+

David A. Fournier
P.O. Box 2040,
Sidney, B.C. V8l 3S3
Phone/FAX 250-655-3364

More information about the Users mailing list