On 09/07/2012 11:53 AM, Dirk Eddelbuettel wrote:
As a general, looking at the unit test files can be helpful. Here is one for 
qnorm:

   "runit_qnorm_prob" = list(
   signature( x = "numeric" ),
   '
   NumericVector xx(x) ;
   return List::create(_["lower"] = qnorm( xx, 0.0, 1.0 ),
                      _["upper"] = qnorm( xx, 0.0, 1.0, false));
   ')

Ie you can just call 'pnorm', 'qnorm', ...

Dirk

Hi Dirk:

Well, I assumed as much.  But, here's what I see...


str <- '
double a=as<double>(arg1), b=as<double>(arg2);

return wrap(qnorm(a, b, 1.));
'

check2 <- cxxfunction(signature(arg1="numeric", arg2="numeric"), str, plugin="Rcpp")

#check2(0.5, 0.5)

 33: return wrap(qnorm(a, b, 1.));
 34:
 35: END_RCPP
 36: }
 37:
 38:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file33b64e743def.cpp: In function 'SEXPREC* file33b64e743def(SEXPREC*, SEXPREC*)': file33b64e743def.cpp:33: error: no matching function for call to 'qnorm5(double&, double&, double)'
make: *** [file33b64e743def.o] Error 1
In addition: Warning message:
running command '/opt/local/lib64/R/bin/R CMD SHLIB file33b64e743def.cpp 2> file33b64e743def.cpp.err.txt' had status 1

Am I doing something stupid?  Thanks
--
Rodney Sparapani, PhD  Center for Patient Care and Outcomes Research
Sr. Biostatistician               http://www.mcw.edu/pcor
4 wheels good, 2 wheels better!   Medical College of Wisconsin (MCW)
WWLD?:  What Would Lombardi Do?   Milwaukee, WI, USA
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to