[ADMB Users] How to use vector elements in PARAMETER_SECTION
Steve Teo - NOAA Federal
steve.teo at noaa.gov
Tue Apr 2 17:24:10 PDT 2013
Thanks Jim. That's exactly what I needed. It was great chatting with you
Just trying to get a toy model for blue shark going and learn ADMB at the
On Tue, Apr 2, 2013 at 5:16 PM, Jim Ianelli - NOAA Federal <
jim.ianelli at noaa.gov> wrote:
> Great to see you the other week!
> Not such a beginner issue!
> 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).
> 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.
> 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)
> init_bounded_number_vector x(1,np,1,lb_x,ub_x,phase_x)
> So this becomes economical perhaps in a different way than what you are
> On Tue, Apr 2, 2013 at 4:40 PM, Steve Teo - NOAA Federal <
> steve.teo at noaa.gov> wrote:
>> 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.
>> On Tue, Apr 2, 2013 at 4:14 PM, Martell, Steven <
>> s.martell at fisheries.ubc.ca> wrote:
>>> You need to use vectors to declare the dimensions of a vector. your
>>> trying to use double precision numbers to delcare the dimensions:
>>> init_ivector x_input(1,2)
>>> int x_lb
>>> !! x_lb=x_input(1);
>>> init_bounded_number x(x_input(1),x_input(2))..
>>> On 2013-04-02, at 3:08 PM, Steve Teo - NOAA Federal <steve.teo at noaa.gov>
>>> > Hi,
>>> > 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.
>>> > Is there an elegant way of doing this without having to initialize
>>> lots of numbers just to set up the bounds?
>>> > DATA_SECTION
>>> > init_vector x_input(1,2)
>>> > number x_lb
>>> > number x_ub
>>> > !!x_lb = x_input;
>>> > !!x_ub = x_input;
>>> > PARAMETER_SECTION
>>> > init_bounded_number x(x_lb,x_ub) // works
>>> > init_bounded_number x(x_input, x_input) // does NOT work
>>> > Thanks.
>>> > Steve
>>> > _______________________________________________
>>> > Users mailing list
>>> > Users at admb-project.org
>>> > http://lists.admb-project.org/mailman/listinfo/users
>> Users mailing list
>> Users at admb-project.org
> James Ianelli
> NMFS/NOAA Building 4
> 7600 Sand Pt Way NE
> Seattle WA 98115
> 206 526 6510
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users