[Rcpp-devel] more on stats functions
romain at r-enthusiasts.com
Thu Dec 9 10:58:02 CET 2010
Le 09/12/10 04:54, Christian Gunning a écrit :
> On Wed, Dec 8, 2010 at 1:18 AM, Romain Francois
> <romain at r-enthusiasts.com> wrote:
>> It might make sense to get rid of the log = argument and maybe add a ldnorm,
>> or log_dnorm, or dnorm_log instead. so that there is no ambiguity.
> One nice part about the current setup is that R-exts.pdf chapter 6
> serves as a (mostly) definitive guide for arguments and behavior,
> since the Rf_* functions are at the back-end.
Makes sense. It is easy to just require that people use double and not
int to avoid the confusion.
> The only d* example I
> found that didn't work (given that all non-missing scalar arguments
> were doubles) was:
> wrong = cxxfunction(signature(x='numeric'),
> 'NumericVector xx(x) ;
> return( xx = dunif( xx, true ));',
> vv<- seq(0, 1, by = 0.1)
> identical(wrong(vv), dunif(vv, log=TRUE))
Thanks. rev 2749 fixes it.
>> It would be great to recycle this effort of yours into testing. Can you have
>> a look at the runit.stats.R file and add some test cases.
> See attached for patch with some added d* cases. Patch is relative to
Applied in rev 2750. Thanks.
> Is there a convenient way to run only and all of the tests in
> runit.stats.R? Other than running *all* the Rcpp unit tests, the best
> I found was doing individual tests with:
Professional R Enthusiast
+33(0) 6 28 91 30 30
|- http://bit.ly/fT2rZM : highlight 0.2-5
|- http://bit.ly/gpCSpH : Evolution of Rcpp code size
`- http://bit.ly/hovakS : RcppGSL initial release
More information about the Rcpp-devel