<div dir="ltr"><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">hi!</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">
Great to see you the other week!</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">Not such a beginner issue!</div>
<div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">Well it might seem like it should be obvious but without going into too much detail, ADMB parameter bounds (which I try to avoid whenever possible) are set up a little differently. Short answer, I don't know how to do exactly what you want (others may know). </div>
<div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">On the other hand, perhaps if you think about it from a vector of parameters, x dimensioned 1 to np things can become efficient for you.</div>
<div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">In the data section you can read in vectors of lower bounds (lb_x) and upper bounds (ub_x) and even an ivector of phases from which you wish to turn each element on (phase_x). Then the code below sets any number of parameters with the same number of ADMB lines (I think 3 total, 4 with phases vector)</div>
<div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">PARAMETER_SECTION</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">
...</div><div class="gmail_default"><div class="gmail_default"><font face="trebuchet ms, sans-serif"> init_bounded_number_vector x(1,np,1,lb_x,ub_x,phase_x)</font></div><div style="font-family:'trebuchet ms',sans-serif">
<br></div><div style="font-family:'trebuchet ms',sans-serif">So this becomes economical perhaps in a different way than what you are thinking.</div><div style="font-family:'trebuchet ms',sans-serif"><br></div>
<div style="font-family:'trebuchet ms',sans-serif">Cheers,</div><div style="font-family:'trebuchet ms',sans-serif">Jim</div></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 2, 2013 at 4:40 PM, Steve Teo - NOAA Federal <span dir="ltr"><<a href="mailto:steve.teo@noaa.gov" target="_blank">steve.teo@noaa.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Steve,<div><br></div><div>That's not it. I am not trying to declare the dimensions of a vector. I am just trying to set up the bounds of a bounded parameter in the PARM_SECTION. I know that if I declare a double first and then use that double in the PARM_SECTION to set bounds, it works. But that is ugly coding (6 lines and 3 variable names extra per parm). So I am wondering if there is an elegant way of calling an element in the vector directly when setting up the bounds and phases. If there is not, that's fine - just wanted to know. Thanks.</div>
<div><br></div><div>Steve</div><div><br></div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 2, 2013 at 4:14 PM, Martell, Steven <span dir="ltr"><<a href="mailto:s.martell@fisheries.ubc.ca" target="_blank">s.martell@fisheries.ubc.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You need to use vectors to declare the dimensions of a vector. your trying to use double precision numbers to delcare the dimensions:<br>
<br>
try:<br>
<br>
DATA_SECTION<br>
init_ivector x_input(1,2)<br>
int x_lb<br>
<br>
!! x_lb=x_input(1);<br>
<br>
PARA<br>
init_bounded_number x(x_input(1),x_input(2))..<br>
<br>
S<br>
On 2013-04-02, at 3:08 PM, Steve Teo - NOAA Federal <<a href="mailto:steve.teo@noaa.gov" target="_blank">steve.teo@noaa.gov</a>><br>
<div><div> wrote:<br>
<br>
> Hi,<br>
><br>
> Beginner with ADMB here. I am trying to read in a vector, which I then use to set up the bounds in my parameter section. The code runs if I initialize the elements as numbers before I use them. But it chokes if I directly reference the vector element. See below for example code.<br>
><br>
> Is there an elegant way of doing this without having to initialize lots of numbers just to set up the bounds?<br>
><br>
> DATA_SECTION<br>
> init_vector x_input(1,2)<br>
><br>
> number x_lb<br>
> number x_ub<br>
> !!x_lb = x_input[1];<br>
> !!x_ub = x_input[2];<br>
><br>
> PARAMETER_SECTION<br>
> init_bounded_number x(x_lb,x_ub) // works<br>
> init_bounded_number x(x_input[1], x_input[2]) // does NOT work<br>
><br>
> Thanks.<br>
><br>
> Steve<br>
</div></div>> _______________________________________________<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>
<br>
</blockquote></div><br></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@admb-project.org">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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><p><font face="trebuchet ms, sans-serif"><a name="SafeHtmlFilter_SafeHtmlFilter_SafeHtmlFilter_SafeHtmlFilter_SafeHtmlFilter__MailAutoSig">James
Ianelli<br></a>NMFS/NOAA Building 4<br>7600 Sand Pt Way NE<br>Seattle WA 98115</font></p><p></p>
<p><font face="trebuchet ms, sans-serif"> 206 526 6510</font></p><p></p></div>
</div>