[ADMB Users] no assignment operator for init_bounded_number_vector

CHRIS GRANDIN cgrandin at shaw.ca
Fri Jul 19 12:49:04 PDT 2013


Hi Larry,
  You need to change line 410 to this:
logsrx.set_initial_value(value(log(srx_init)));

You'll also need to do the same with the next line for logbeta.
I couldn't really test it since I don't have yout .dat and .ctl files, but it does compile and link.
Cheers
Chris

----- Original Message -----
From: "Larry Jacobson" <larry.jacobson at noaa.gov>
To: "ADMB Users" <Users at admb-project.org>
Sent: Friday, July 19, 2013 10:43:01 AM
Subject: [ADMB Users] no assignment operator for init_bounded_number_vector


1) The idea is to ask the user for an arithmetic starting value which is used to initialize a log scale parameter (unbeknownst to the user who does not think in logs). 

2) I have a vector of doubles declared in the DATA_SECTION called srx_init(1,2). See line 193 in attached tpl file. 

3) I declare a bounded_number_vector in the PARAMETER_SECTION called logsrx(1,2). See line 283 in tpl file. 

4) In the PRELIMINARY_CALCS_SECTION (line 410) I want to initialize the bounded_number_vector with code like: 
logsrx=log(srx_init); 

5) However, the compiler complains: 
C:\Users\ljacobso\Documents\Assessments\Shrimp_2013\CSA-v4\july18_2013>cl /c /EHsc /DUSE_LAPLACE /DWIN32 /DSAFE_ALL /D 
__MSVC32__=8 /I. /I"C:\Program Files\ADMB"\include /I"C:\Program Files\ADMB"\contrib\include csav41.cpp 
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86 
Copyright (C) Microsoft Corporation. All rights reserved. 

csav41.cpp 
csav41.cpp(362) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'dvector' (or the 
re is no acceptable conversion) 
C:\Program Files\ADMB\include\admodel.h(2700): could be 'param_init_bounded_number_vector &param_init_bounded_nu 
mber_vector::operator =(const param_init_bounded_number_vector &)' 
while trying to match the argument list '(param_init_bounded_number_vector, dvector)' 

6) I've tried doing the assignment in a loop like: 
for (i=1;i<=nsurveys;i++) logsrx(i)=log(srx_init(i)); 

using an intermediate dvar_vector like: 
dvar_vector temp(1,2)=srx_init; 
logsrxi=srxinit; 

and many other hacks (trying to find a combination of data types with an assignment operator). 

6) Any ideas or suggestions? 

Cheers and thanks! 



-- 
**********************
Opinions that may be expressed herein are my own 
and not official positions of NOAA or the National 
Marine Fisheries Service. 
**********************
Larry Jacobson
National Marine Fisheries Service
Northeast Fisheries Science Center
166 Water Street
Woods Hole, MA 02543-1026
Voice: 508-495-2317
Fax: 508-495-2393
E-mail: larry.jacobson at noaa.gov ********************** 
_______________________________________________
Users mailing list
Users at admb-project.org
http://lists.admb-project.org/mailman/listinfo/users



More information about the Users mailing list