[ADMB Users] Summary: Fwd: no assignment operator for init_bounded_number_vector
larry.jacobson at noaa.gov
Mon Jul 22 05:50:21 PDT 2013
1) I was trying to initialize an init_bounded_number_vector parameter
called logsrx in the initialization section but there was no assignment
2) Chris Grandin (many thanks) knew just what to do and suggested the
Note that it is important to make sure the argument with the initial value is a double so there is no harm in using:
3) Rick Methot pointed out that assignment to many classes (but not bounded_number_vectors) can be managed using the value function only.
3) I couldn't find any documentation re set_initial_value but Chris mentioned that "The definition is in src/nh99/mcmcvar.h on line 2489."
> The equals sign and value() will work for most classes, but the param_init_bounded_number_vector class has no assignment operator overloaded so you have to do it with set_initial_value. The definition is in src/nh99/mcmcvar.h on line 2489
-------- Original Message --------
Subject: no assignment operator for init_bounded_number_vector
Date: Fri, 19 Jul 2013 13:43:01 -0400
From: Larry Jacobson <larry.jacobson at noaa.gov>
Reply-To: Larry.Jacobson at noaa.gov
To: ADMB Users <Users at admb-project.org>
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:
5) However, the compiler complains:
/EHsc /DUSE_LAPLACE /DWIN32 /DSAFE_ALL /D
__MSVC32__=8 /I. /I"C:\Program Files\ADMB"\include /I"C:\Program
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
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
mber_vector::operator =(const param_init_bounded_number_vector &)'
while trying to match the argument list
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:
and many other hacks (trying to find a combination of data types with an
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.
National Marine Fisheries Service
Northeast Fisheries Science Center
166 Water Street
Woods Hole, MA 02543-1026
E-mail:larry.jacobson at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users