[ADMB Users] How to use vector elements in PARAMETER_SECTION

Martell, Steven s.martell at fisheries.ubc.ca
Tue Apr 2 16:14:35 PDT 2013


You need to use vectors to declare the dimensions of a vector. your trying to use double precision numbers to delcare the dimensions:

try:

DATA_SECTION
	init_ivector x_input(1,2)
	int x_lb
	
	!! x_lb=x_input(1);

PARA
	init_bounded_number x(x_input(1),x_input(2))..

S
On 2013-04-02, at 3:08 PM, Steve Teo - NOAA Federal <steve.teo at noaa.gov>
 wrote:

> 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[1];
>   !!x_ub = x_input[2];
>   
> PARAMETER_SECTION
>   init_bounded_number x(x_lb,x_ub) // works
>   init_bounded_number x(x_input[1], x_input[2]) // does NOT work  
> 
> Thanks.
> 
> Steve
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users




More information about the Users mailing list