[Rcpp-devel] NumericVector Double mismatch when indexing an array

Rodney Sparapani rsparapa at mcw.edu
Tue Sep 25 23:19:30 CEST 2012


On 09/25/2012 03:41 PM, Dirk Eddelbuettel wrote:
> In the interest of constructive criticism, my version (and I must posted
> essentially the same maybe ten times already on this very list):
>
> R>  f3<- cxxfunction(signature(), plugin="Rcpp", body='
> +    RNGScope scope;
> +    NumericVector rn = Rcpp::rnorm(5,0,1);
> +    return wrap(rn);
> + ')
> R>  f3()
> [1] -0.837983 -0.706765  0.551781  0.662024  0.495562
> R>

Very good.  Just one quick question since I have come across
this in the documentation somewhere, but I can't seem to find
it anymore.  Can you pass optimization flags like so?

f3<- cxxfunction(signature(), plugin="Rcpp", body='
      RNGScope scope;
      NumericVector rn = Rcpp::rnorm(5,0,1);
      return wrap(rn);',
      cppflags="-O2")
      ^^^^^^^^^^^^^^
I tried it, but it doesn't seem to make a noticeable impact on
these benchmarks.  Is that because it is ignoring them or it
just has no benefit?
-- 
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