[ADMB Users] bug in file f1b2vc1
John Sibert
sibert at hawaii.edu
Thu Aug 6 23:25:57 PDT 2009
Ben -
Below is a simple Makefile that works for the ADMB simple example with
Ubuntu (64 bit). You would have to modify it to include additional
source files. (But why don't you simply include the f1b2vc1.cpp source
code in the GLOBALS_SECTION of your tpl?).
Cheers,
John
(Remember the leading spaces need to be replaced by a tab.)
.SUFFIXES: .tpl
.PHONY: CLEAN RULES
CC=$(ADMB_HOME)/bin/mygcco
LL=$(CC)
simple: simple.cpp simple.o
$(LL) simple
.cpp.o:
$(CC) $*
.tpl.cpp:
$(ADMB_HOME)/bin/tpl2cpp $*
CLEAN:
rm -fv *.o
rm -fv *.htp
rm -fv simple.cpp
rm -fv simple
RULES:
@echo "ADMB_HOME = "$(ADMB_HOME)
@echo "CC = "$(CC)
@echo "LL = "$(LL)
Bolker,Benjamin Michael wrote:
> 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
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>
>
--
Visit the ADMB project http://admb-project.org/
More information about the Users
mailing list