[Rcpp-devel] Unit Test Question Was: pnorm/qnorm?

Rodney Sparapani rsparapa at mcw.edu
Wed Sep 12 16:28:17 CEST 2012


On 09/12/2012 08:58 AM, Dirk Eddelbuettel wrote:

>     edd at max:~$ grep -r qnorm /usr/local/lib/R/site-library/Rcpp/include/ | wc -l
>     10
>     edd at max:~$
>
> There is no magic pixie dust. Some headers are script-generated, even those
> scripts are in SVN.  Some of the p/q/d/r-sugar functions are from macro
> expansions as you will see.
>
> Dirk
>

Dear Dirk:

You didn't show the 10 lines.  I've looked these over
many times, but I didn't get it until just now.  If anybody
else cares, here are the 3 that really matter...

PREFIX/lib64/R/library/Rcpp/include/Rcpp/stats/norm.h
106:RCPP_DPQ_0(norm, Rcpp::stats::dnorm_0, Rcpp::stats::pnorm_0, 
Rcpp::stats::qnorm_0 )
107:RCPP_DPQ_1(norm, Rcpp::stats::dnorm_1, Rcpp::stats::pnorm_1, 
Rcpp::stats::qnorm_1 )
108:RCPP_DPQ_2(norm, ::Rf_dnorm4, ::Rf_pnorm5, ::Rf_qnorm5 )

To see what is going on, take a look at the combination of
pre-processor macro and C++ template code (AKA magic pixie dust) in
PREFIX/lib64/R/library/Rcpp/include/Rcpp/stats/dpq/dpq.h

Bravo!
-- 
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


More information about the Rcpp-devel mailing list