[ADMB Users] Invoking library qfclib.h
sibert at hawaii.edu
Thu May 23 16:18:26 PDT 2013
Hmm. I'm not sure which OS your are using, but in my world double
round(double) requires only one argument, not two as in your report
section example. It is part of the standard C/C++ math library and is
not an ADMB function.
The " error: cannot convert 'param_init_bounded_number' to 'double' for
argument '1' to 'double round(double)' " can probably be eliminated by
report << "FPSFpD=" << round(value(FPSFpD)) << endl;
The value function returns the double part of the variable, and there is
only one argument to round.
Emeritus Researcher, SOEST
University of Hawaii at Manoa
Honolulu HI (GMT-10)
Visit the ADMB project http://admb-project.org/
On 05/23/2013 11:10 AM, Rice, Cliff G (DFW) wrote:
> Mssrs. Sibert and Grandin,
> I am simply trying to round a parameter value for display in the report section, e.g.,
> init_bounded_number FPSFpD(0.2,0.7)
> report<<"FPSFpD="<<round(FPSFpD, 2)<<<<endl;
> Produces the error:
> error: cannot convert 'param_init_bounded_number' to 'double' for argument '1' to 'double round(double)'
> This is true whether or not I have the include <contrib.h> statement in the TPL.
> I discovered you can use round() to round a 'plain' number, but apparently not a bounded number.
> So, I looked for other people's approaches and found the qfclib.h library.
> When I couldn't get the example to work, I quoted it in my question, not my own program, because the example was available for everyone to see. However, the example uses the round function on a nested function - I guess to show how versatile it is, but I'm not interested in what those nested functions.
> P.S. I have been trying for the last week to get a message to the Group Owner to make me a member so I can respond directly, but without success (Google keep giving an error). So, I am sending this directly to you as well as cc'ing the group.
> -----Original Message-----
> From: John Sibert [mailto:sibert at hawaii.edu]
> Sent: Thursday, May 16, 2013 6:08 PM
> To: Rice, Cliff G (DFW)
> Cc: users at admb-project.org
> Subject: Re: [ADMB Users] Invoking library qfclib.h
> What are you trying to do?
> Both round(rgamma(2.5,2.5,rnd),3) and round(rdirichlet(p,rnd),2) parse into two arguments to the function double round(double).
> John Sibert
> Emeritus Researcher, SOEST
> University of Hawaii at Manoa
> Honolulu HI (GMT-10)
> Visit the ADMB project http://admb-project.org/
> On 05/16/2013 10:43 AM, Rice, Cliff G (DFW) wrote:
>> I'm trying to use the rounding function described in qfc_sim.cpp
>> I have tried the test file
>> This file includes the command
>> #include "qfclib.h" in the GLOBALS_SECTION
>> However, when compiling, I receive the errors:
>> error: too many arguments to function 'double round(double)' evidently
>> for round(rgamma(2.5,2.5,rnd),3) [line 22]
>> error: cannot convert 'dvector' to 'double' for argument '1' to
>> 'double round(double)' for round(rdirichlet(p,rnd),2) [line 23]
>> among others.
>> These errors are exactly those produced if the include statement is
>> Judging from statements in qfc_sim.cpp:
>> * 5. round your matrix, vector, sclar to some specific decimals for
>> * in report_section, such as round(dmatrix,4), see round() \n
>> Evidently I'm missing something.
>> Cliff Rice
>> Users mailing list
>> Users at admb-project.org
More information about the Users