<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
1) I was trying to initialize an init_bounded_number_vector
parameter called logsrx in the initialization section but there was
no assignment operator.<br>
<br>
2) Chris Grandin (many thanks) knew just what to do and suggested
the following code:<br>
<pre wrap=""><blockquote type="cite"><pre wrap="">logsrx.set_initial_value(srx_init);
</pre></blockquote>
Note that it is important to make sure the argument with the initial value is a double so there is no harm in using:
<blockquote type="cite"><pre wrap="">logsrx.set_initial_value(value(srx_init));
</pre></blockquote>
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."
Cheers!
</pre>
<br>
<div class="moz-forward-container"><br>
and later:<br>
<br>
<blockquote type="cite">
<pre wrap="">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
Chris
</pre>
</blockquote>
<br>
<br>
-------- Original Message --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Subject:
</th>
<td>no assignment operator for init_bounded_number_vector</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Date: </th>
<td>Fri, 19 Jul 2013 13:43:01 -0400</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">From: </th>
<td>Larry Jacobson <a class="moz-txt-link-rfc2396E" href="mailto:larry.jacobson@noaa.gov"><larry.jacobson@noaa.gov></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Reply-To:
</th>
<td><a class="moz-txt-link-abbreviated" href="mailto:Larry.Jacobson@noaa.gov">Larry.Jacobson@noaa.gov</a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">To: </th>
<td>ADMB Users <a class="moz-txt-link-rfc2396E" href="mailto:Users@admb-project.org"><Users@admb-project.org></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
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).<br>
<br>
2) I have a vector of doubles declared in the DATA_SECTION called
srx_init(1,2). See line 193 in attached tpl file. <br>
<br>
3) I declare a bounded_number_vector in the PARAMETER_SECTION
called logsrx(1,2). See line 283 in tpl file.<br>
<br>
4) In the PRELIMINARY_CALCS_SECTION (line 410) I want to
initialize the bounded_number_vector with code like:<br>
logsrx=log(srx_init);<br>
<br>
5) However, the compiler complains:<br>
<tt><small><small><small><small><small><small>C:\Users\ljacobso\Documents\Assessments\Shrimp_2013\CSA-v4\july18_2013>cl
/c /EHsc /DUSE_LAPLACE /DWIN32 /DSAFE_ALL /D<br>
__MSVC32__=8 /I. /I"C:\Program Files\ADMB"\include
/I"C:\Program Files\ADMB"\contrib\include csav41.cpp<br>
Microsoft (R) 32-bit C/C++ Optimizing Compiler
Version 16.00.30319.01 for 80x86<br>
Copyright (C) Microsoft Corporation. All rights
reserved.<br>
<br>
csav41.cpp<br>
csav41.cpp(362) : error C2679: binary '=' : no
operator found which takes a right-hand operand of
type 'dvector' (or the<br>
re is no acceptable conversion)<br>
C:\Program
Files\ADMB\include\admodel.h(2700): could be
'param_init_bounded_number_vector
¶m_init_bounded_nu<br>
mber_vector::operator =(const
param_init_bounded_number_vector &)'<br>
while trying to match the argument list
'(param_init_bounded_number_vector, dvector)'<br>
</small></small></small></small></small></small></tt><br>
6) I've tried doing the assignment in a loop like:<br>
for (i=1;i<=nsurveys;i++) logsrx(i)=log(srx_init(i));<br>
<br>
using an intermediate dvar_vector like:<br>
dvar_vector temp(1,2)=srx_init;<br>
logsrxi=srxinit;<br>
<br>
and many other hacks (trying to find a combination of data types
with an assignment operator).<br>
<br>
6) Any ideas or suggestions?<br>
<br>
Cheers and thanks!<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
**********************
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: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:larry.jacobson@noaa.gov">larry.jacobson@noaa.gov</a>
**********************
</pre>
<br>
</div>
<br>
</body>
</html>