[ADMB Users] Fwd: > dvariable in separable function
Mollie Brooks
mbrooks at ufl.edu
Tue Nov 1 08:53:59 PDT 2011
I did the version from my first try.
> if(value(fpen)>0.0)
solved the problem.
Thanks!
Mollie
On 1 Nov 2011, at 9:14 AM, Weihai Liu wrote:
>
>
> ---------- Forwarded message ----------
> From: Weihai Liu <liuweih at msu.edu>
> Date: Tue, Nov 1, 2011 at 9:12 AM
> Subject: Re: [ADMB Users] > dvariable in separable function
> To: Mollie Brooks <mbrooks at ufl.edu>
>
>
> for your second try, use these inside your separable function,
> fpen=dvariable(0.0);
> if(value(fpen)>0.0)
>
> if it works, let me know.
>
> weihai
>
> On Mon, Oct 31, 2011 at 11:42 PM, Mollie Brooks <mbrooks at ufl.edu> wrote:
> Hello,
> I need to use posfun in a separable function. Then I'd like to output the value of fpen if it's more than 0. I declared fpen as a dvariable within the separable function. There doesn't seem to be the right operator defined.
> sepvar_shts_nb.cpp:243: error: no match for ‘operator>’ in ‘fpen > 0.0’
> /home/mbrooks/admb/include/fvar.hpp:7923: note: candidates are: int operator>(double, const prevariable&)
> /home/mbrooks/admb/include/df32fun.h:290: note: int operator>(const df3_two_variable&, double)
> /home/mbrooks/admb/include/df32fun.h:296: note: int operator>(const df3_two_variable&, const df3_two_variable&)
>
>
> Instead, I tried declaring it as a number in the parameter section and sending it to the separable function, but I have to send it as a dvariable so I have the same problem.
>
> SEPARABLE_FUNCTION void obs(dvariable fpen,int i,const dvar_vector& fcoeffs,const dvariable& indiv_std,const dvariable& indiv_slope_std,const dvariable& year_std,const dvariable& plot_std,const dvariable& rcoeff_indiv,const dvariable& rcoeff_indiv_slope,const dvariable& rcoeff_plot,const dvariable& rcoeff_year,const dvariable& k)
> dvariable prediction=fixmm(i)*fcoeffs+
> indiv_std*rcoeff_indiv+
> indiv_slope_std*rcoeff_indiv_slope*fixmm(i,1)+ //The 1st column should be shts
> year_std*rcoeff_year+
> plot_std*rcoeff_plot;
> fpen = 0.0;
> prediction=posfun(prediction, 0.0000001, fpen);
> if(fpen>0.0)cout<<endl<<"fpen="<<fpen<<endl;
> jnll+=100000*fpen;
> jnll-=gammln(k+shts_next(i))-gammln(k)-gammln(shts_next(i)+1)+k*log(k)-k*log(prediction+k)+shts_next(i)*log(prediction)-shts_next(i)*log(prediction+k);
>
> sepvar_shts_nb.cpp:245: error: no match for ‘operator=’ in ‘fpen = 0.0’
> /home/mbrooks/admb/include/df1b2fnl.h:114: note: candidates are: funnel_init_df1b2variable& funnel_init_df1b2variable::operator=(const funnel_init_df1b2variable&)
> sepvar_shts_nb.cpp:247: error: no match for ‘operator>’ in ‘fpen > 0.0’
> /home/mbrooks/admb/include/fvar.hpp:7923: note: candidates are: int operator>(double, const prevariable&)
> /home/mbrooks/admb/include/df32fun.h:290: note: int operator>(const df3_two_variable&, double)
> /home/mbrooks/admb/include/df32fun.h:296: note: int operator>(const df3_two_variable&, const df3_two_variable&)
>
> Has anyone had this problem with using the > operator? Any ideas for workarounds?
> thanks,
> Mollie
>
> Mollie Brooks
> Ph.D. Candidate
> NSF IGERT Fellow
> Biology Department
> University of Florida
> mbrooks at ufl.edu
> http://people.biology.ufl.edu/mbrooks
>
>
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20111101/95b62df8/attachment.html>
More information about the Users
mailing list