[Rcpp-devel] Broken (undone) Rmath functions

Romain Francois romain at r-enthusiasts.com
Thu Sep 16 20:22:29 CEST 2010


Le 16/09/10 20:13, Lovett, Mitch a écrit :
> I just joined the mailing list,

welcome !

> so I apologize if this question has
> already been posted.

about 19 hours ago. Feel free to browse the archives either:
- on r-forge : http://lists.r-forge.r-project.org/pipermail/rcpp-devel/
- on gmane : http://news.gmane.org/gmane.comp.lang.r.rcpp

this thread has the information: 
http://thread.gmane.org/gmane.comp.lang.r.rcpp/762

> After installing the latest version of Rcpp, my code that called Rmath
> functions no longer works. After a brief look, it appears you are now
> undoing all of the Rmath definitions to allow the new code(?).

yes.

> Is there
> a way to easily undo your undoing of these without breaking the new
> sugar functionality?

You can just prefix your calls with Rf_, so instead of calling dnorm, 
you call Rf_dnorm, etc ...

You can use the RCPP_VERSION macro if you want this to work accross Rcpp 
versions, something like :

#if defined(RCPP_VERSION) && RCPP_VERSION >= Rcpp_Version(0,8,6)
# define my_dnorm Rf_dnorm
#else
# define my_dnorm dnorm
#endif

Romain

> Any suggestions?
>
> Thanks,
>
> Mitch


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/cCmbgg : Rcpp 0.8.6
|- http://bit.ly/bzoWrs : Rcpp svn revision 2000
`- http://bit.ly/b8VNE2 : Rcpp at LondonR, oct 5th




More information about the Rcpp-devel mailing list