[ADMB Users] Invoking library qfclib.h

John Sibert sibert at hawaii.edu
Thu May 23 17:34:09 PDT 2013


Weird. You are using the horrible old green function reference guide 
(aka the dox), last built in 2010.

You should have a look at a more current version at 
http://www.admb-project.org/documentation/api/ (which claims to have 
been built today).

As far as I know there are no value( ) member functions in class 
param_init_bounded_number or any other class that can be called as 
FPSFpD.value()


John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa
Honolulu HI (GMT-10)
808-294-3842

Visit the ADMB project http://admb-project.org/

On 05/23/2013 01:43 PM, Rice, Cliff G (DFW) wrote:
>
> Thanks,
>
> round(value(FPSFpD)) worked just fine (except that you have to 
> multiply then divide by  the number of decimal places you want).
>
> It may be of interest that Chris's suggestion of using FPSFpD.value() 
> returns the error:
>
> 'class param_init_bounded_number' has no member named 'value' even 
> though value is in the member list for 'class 
> param_init_bounded_number' 
> <http://admb-foundation.org/documentation/api/default/classparam__init__bounded__number-members.html> 
> [http://admb-foundation.org/documentation/api/default/classparam__init__bounded__number-members.html].
>
> Cliff
>
> -----Original Message-----
> From: John Sibert [mailto:sibert at hawaii.edu]
> Sent: Thursday, May 23, 2013 4:18 PM
> To: Rice, Cliff G (DFW)
> Cc: CHRIS GRANDIN; users at admb-project.org
> Subject: Re: [ADMB Users] Invoking library qfclib.h
>
> 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.
>
> John Sibert
>
> Emeritus Researcher, SOEST
>
> University of Hawaii at Manoa
>
> Honolulu HI (GMT-10)
>
> 808-294-3842
>
> 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.,
>
> > Given:
>
> > PARAMETER_SECTION
>
> > init_bounded_number FPSFpD(0.2,0.7)
>
> > .
>
> > .
>
> > .
>
> > REPORT_SECTION
>
> > 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.
>
> >
>
> > Thanks,
>
> > Cliff
>
> >
>
> > 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 <mailto: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)
>
> > 808-294-3842
>
> >
>
> > 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
>
> >> <http://admb-project.org/svn/trunk/contrib/qfclib/qfc_sim.cpp>.
>
> >> (http://admb-project.org/svn/trunk/contrib/qfclib/qfc_sim.cpp)
>
> >>
>
> >> I have tried the test file
>
> >> 
> <http://admb-project.org/svn/trunk/contrib/qfclib/tests/testfunction.tpl>.
>
> >> (http://admb-project.org/svn/trunk/contrib/qfclib/tests/testfunction.
>
> >> tpl)
>
> >>
>
> >> 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]
>
> >>
>
> >> and
>
> >>
>
> >> 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
>
> >> absent.
>
> >>
>
> >> Judging from statements in qfc_sim.cpp:
>
> >>
>
> >> * 5. round your matrix, vector, sclar to some specific decimals for
>
> >> display
>
> >>
>
> >> * in report_section, such as round(dmatrix,4), see round() \n
>
> >>
>
> >> Evidently I'm missing something.
>
> >>
>
> >> Thanks,
>
> >>
>
> >> Cliff Rice
>
> >>
>
> >>
>
> >>
>
> >> _______________________________________________
>
> >> Users mailing list
>
> >> Users at admb-project.org <mailto:Users at admb-project.org>
>
> >> http://lists.admb-project.org/mailman/listinfo/users
>
> >
>
> >
>




More information about the Users mailing list