[ADMB Users] bug in file f1b2vc1
Bolker,Benjamin Michael
bolker at ufl.edu
Thu Aug 6 20:49:12 PDT 2009
Thanks very much Dave ...
Next question (sorry!!!)
Is there, somewhere, a start-up document about how to build
ADMB binaries from source? I say this because I feel like I am about
to enter dependency hell in trying to make/link the new version
of f1b2vc1.cpp -- e.g. when I try g++ -c f1b2vc1.cpp I get
warnings about .h files missing; when I copy the .h files over
from the ADMB source files, I then have to change the <file.h>
format to "file.h" so my system can find them ... etc. ...
It feels like the easiest (??) thing to do in order to
incorporate the bug fix that you sent would be to
replace the relevant file in the SVN copy of the source from
the google code site and rebuild the binaries, but that seems to contain "only" source code,
and not any information about the build environment (I guess I
was expecting to see Makefiles in there ...) Does anyone have
suggestions? I am running on Ubuntu Linux with standard tools (gcc/g++ 4.3.2 GNU Make 3.81, etc.)
Just doing something naive like cd admb-project-read-only/df1b2-separable; g++ -c *.cpp
doesn't work ...
I have poked around on
http://admb-project.org/community/public-domain
but not found anything I can understand yet ...
One of these days I will stop bothering everyone ...
cheers
Ben Bolker
________________________________________
From: users-bounces at admb-project.org [users-bounces at admb-project.org] On Behalf Of dave fournier [otter at otter-rsch.com]
Sent: Thursday, August 06, 2009 11:29 AM
To: users at admb-project.org
Subject: [ADMB Users] bug in file f1b2vc1
Thanks Ben you found a fatal bug. Hard to believe that function had
never been used before. In the file f1b2vc1.cpp
the line
ADUNCONST(df1b2vector,x)
should have been
ADUNCONST(dvector,x)
df1b2vector operator + (const dvector& _x,const df1b2vector& _y)
{
ADUNCONST(df1b2vector,x)
ADUNCONST(df1b2vector,y)
check_shape(x,y,"operator +");
int mmin=x.indexmin();
int mmax=x.indexmax();
df1b2vector tmp;
tmp.noallocate(mmin,mmax);
for (int i=mmin;i<=mmax;i++)
{
tmp(i)=x(i)+y(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);
f+=ppen;
ppen=0.0;
dvar_vector pprob2=1.0-posfun(1.0-pprob,0.01,ppen);
f+=ppen;
f+=0.5*norm2(u); // prior
f -= sum( log_comb(initial,killed)+
elem_prod(killed,log(pprob2))+
elem_prod(initial-killed,log(1-pprob2)));
--
David A. Fournier
P.O. Box 2040,
Sidney, B.C. V8l 3S3
Canada
Phone/FAX 250-655-3364
http://otter-rsch.com
_______________________________________________
Users mailing list
Users at admb-project.org
http://lists.admb-project.org/mailman/listinfo/users
More information about the Users
mailing list