[Rcpp-devel] No matching function for calls to Rmath.h
Romain Francois
romain at r-enthusiasts.com
Thu Sep 16 22:10:58 CEST 2010
Le 16/09/10 22:00, Davor Cubranic a écrit :
> On 2010-09-15, at 4:30 PM, Dirk Eddelbuettel wrote:
>
>> It's a feature :)
>>
>> First, the fix -- use ::Rf_dpois to access R's scalar variant directly:
>
> Thanks, that indeed solved the problem.
>
>> The NEWS file etc would have lead you there, but then we tend to change so
>> many things that it is easy to overlook items :)
>>
>
> I did read the announcement, but completely missed the significance of:
>
>> o new sugar functions for statistical distributions (d-p-q-r functions)
>> with distributions : unif, norm, gamma, chisq, lnorm, weibull, logis,
>> f, pois, binom, t, beta.
>
> I should have added that in my original code, I ran into this error while I was in RcppArmadillo-land, so the new functions on NumericVectors did not really cross my mind.
>
> I knew there were 'Rf_'-prefixed flavours of each of these functions in Rmath.h, but thought they were the same. (I remember seeing '#define dpois Rf_dpois', or something like that.) Are 'Rf_' names the recommended ones?
>
> Can we have 'Rcpp::dpois(double, double, int)'
I was thinking about that. I think we can do that, probably making them
inline.
> or even not shadow the 'dpois' in the global namespace at all?
That we cannot do. There is no "dpois" symbol in the R api, only
Rf_dpois. "dpois" in R is a macro
> I already changed my code to use '::Rf_dpois', so I'm mostly just curious from the technical standpoint. I *had* thought of trying '::dpois' before emailing this list, but that did not help at all and it feels like it would be a good thing (as a C++ programmer) to understand why it did not.
See above. There is no "dpois". macros are evil.
> Davor
--
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