<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Weihai Liu</b> <span dir="ltr"><<a href="mailto:liuweih@msu.edu">liuweih@msu.edu</a>></span><br>Date: Tue, Nov 1, 2011 at 9:12 AM<br>
Subject: Re: [ADMB Users] > dvariable in separable function<br>To: Mollie Brooks <<a href="mailto:mbrooks@ufl.edu">mbrooks@ufl.edu</a>><br><br><br>for your second try, use these inside your separable function,<div>
fpen=dvariable(0.0);</div><div>if(value(fpen)>0.0)</div><div><br></div><div>if it works, let me know.</div><div><br></div><div><font color="#888888">weihai<br><br></font><div class="gmail_quote"><div class="im">
On Mon, Oct 31, 2011 at 11:42 PM, Mollie Brooks <span dir="ltr"><<a href="mailto:mbrooks@ufl.edu" target="_blank">mbrooks@ufl.edu</a>></span> wrote:<br></div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
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.<br>
sepvar_shts_nb.cpp:243: error: no match for ‘operator>’ in ‘fpen > 0.0’<br>
/home/mbrooks/admb/include/fvar.hpp:7923: note: candidates are: int operator>(double, const prevariable&)<br>
/home/mbrooks/admb/include/df32fun.h:290: note: int operator>(const df3_two_variable&, double)<br>
/home/mbrooks/admb/include/df32fun.h:296: note: int operator>(const df3_two_variable&, const df3_two_variable&)<br>
<br>
<br>
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.<br>
<br>
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)<br>
dvariable prediction=fixmm(i)*fcoeffs+<br>
indiv_std*rcoeff_indiv+<br>
indiv_slope_std*rcoeff_indiv_slope*fixmm(i,1)+ //The 1st column should be shts<br>
year_std*rcoeff_year+<br>
plot_std*rcoeff_plot;<br>
fpen = 0.0;<br>
prediction=posfun(prediction, 0.0000001, fpen);<br>
if(fpen>0.0)cout<<endl<<"fpen="<<fpen<<endl;<br>
jnll+=100000*fpen;<br>
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);<br>
<br>
sepvar_shts_nb.cpp:245: error: no match for ‘operator=’ in ‘fpen = 0.0’<br>
/home/mbrooks/admb/include/df1b2fnl.h:114: note: candidates are: funnel_init_df1b2variable& funnel_init_df1b2variable::operator=(const funnel_init_df1b2variable&)<br>
sepvar_shts_nb.cpp:247: error: no match for ‘operator>’ in ‘fpen > 0.0’<br>
/home/mbrooks/admb/include/fvar.hpp:7923: note: candidates are: int operator>(double, const prevariable&)<br>
/home/mbrooks/admb/include/df32fun.h:290: note: int operator>(const df3_two_variable&, double)<br>
/home/mbrooks/admb/include/df32fun.h:296: note: int operator>(const df3_two_variable&, const df3_two_variable&)<br>
<br>
Has anyone had this problem with using the > operator? Any ideas for workarounds?<br>
thanks,<br>
Mollie<br>
<br>
Mollie Brooks<br>
Ph.D. Candidate<br>
NSF IGERT Fellow<br>
Biology Department<br>
University of Florida<br>
<a href="mailto:mbrooks@ufl.edu" target="_blank">mbrooks@ufl.edu</a><br>
<a href="http://people.biology.ufl.edu/mbrooks" target="_blank">http://people.biology.ufl.edu/mbrooks</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@admb-project.org" target="_blank">Users@admb-project.org</a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/users" target="_blank">http://lists.admb-project.org/mailman/listinfo/users</a><br>
</blockquote></div></div></div><br></div>
</div><br>