There will be ever-so-slight performance differences due to
implementation differences (I believe R's functions are just a hair
slower because they are more exact -- though that may be a comparison
with GSL I'm thinking of), but my advice would be to use the RNGs that
come with R. They are the best in the business and you'll have the
benefit of them being auto-upgraded with each new R release (as well
as getting better support from the R lists).

What you really should look into is the Rcpp project. It provides nice
wrappers to R's RNG functions and makes the whole porting process
worlds easier: e.g., http://dirk.eddelbuettel.com/blog/2011/07/14/

Hope this helps,

Michael

On Tue, Mar 13, 2012 at 9:33 AM, Ian Schiller
<ian.schil...@clinepi.mcgill.ca> wrote:
> Hi everyone,
>
> I have built an R package and for the sake of speed I have decided to rewrite 
> some part of the code in C++.  In my original R code I use the pnorm, qnorm, 
> rnorm, pgamma, dgamma, rgamma, rbeta and runif function.  First I was 
> thinking in going with the boost libraries, but I noticed the functions 
> described above are available within the R.h header file (or is it Rmath.h?).
>
> So my question is the following.  Would my code be faster if I install the 
> appropriate boost libraries (distributions) or if I stick with R.h's 
> functions?
>
> Thanks!
>
>
> ******************************************************************************************************************************
> IAN SCHILLER, M.Sc.
>
> Statistical research assistant,
> Division of Clinical Epidemiology, McGill University Health Center
>
> Assistant de recherche en statistiques,
> Département d'Épidémiologie Clinique, Centre Universitaire de Santé Mcgill
>
> Tel: 514 934 1934 ext. 36925
> Email: ian.schil...@clinepi.mcgill.ca<mailto:ian.schil...@clinepi.mcgill.ca>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to