Re: [Rcpp-devel] R::nbinom and R::nbinom_mu give identical results?

2014-10-29 Thread Dirk Eddelbuettel
One more: Turns out R 3.1.1 does not have the required define for the Rf_[dpqr]nbinom_mu, so I had to "park" the definition. Come Friday and R 3.1.2 we can re-enable this as R 3.1.2 appears to correct this. From its NEWS file: * A few recently added C entry points were missing the remappi

Re: [Rcpp-devel] R::nbinom and R::nbinom_mu give identical results?

2014-10-29 Thread Dirk Eddelbuettel
On 29 October 2014 at 14:48, Helske Jouni wrote: | Dear list, | | | | I am trying to call R’s negative binomial function with Rcpp, but encountered | some weird behaviour. Here is an example using inline: | | | | | rcpp_Rf_dnbinom <- rcpp(signature(), | ' return wrap(

Re: [Rcpp-devel] The problem i encountered about RcppEigen double -(k/2)*std::log(2*M_PI)+rooti.diagonal().log().sum(); can not run .

2014-10-29 Thread Yixuan Qiu
Hi Xiaohui, There are several problems in the code I have found: 1. MatrixXd rooti = L.inverse()*Eigen::MatrixXd::Identity(k,k) is not necessary. You are multiplying a matrix with an identity matrix, so it can be simplified as MatrixXd rooti = L.inverse(); 2. k is an integer, so you need to use k

[Rcpp-devel] R::nbinom and R::nbinom_mu give identical results?

2014-10-29 Thread Helske Jouni
Dear list, I am trying to call R’s negative binomial function with Rcpp, but encountered some weird behaviour. Here is an example using inline: rcpp_Rf_dnbinom <- rcpp(signature(), ' return wrap(Rf_dnbinom( 4.0, 0.5, 0.9, 1)); ') rcpp_Rf_dnbinom_mu <- rcpp(signature(),

Re: [Rcpp-devel] The problem i encountered about RcppEigen double -(k/2)*std::log(2*M_PI)+rooti.diagonal().log().sum(); can not run .

2014-10-29 Thread Dirk Eddelbuettel
On 29 October 2014 at 16:08, 李晓辉 wrote: | These days i rewrote the  dmvnorm() function from the mvtnorm package with | RcppEigen which is publised in http://gallery.rcpp.org/articles/dmvnorm_arma/. | The code as follows: | | #include | using namespace Rcpp; | // [[Rcpp::depends(RcppE

[Rcpp-devel] The problem i encountered about RcppEigen double -(k/2)*std::log(2*M_PI)+rooti.diagonal().log().sum(); can not run .

2014-10-29 Thread 李晓辉
These days i rewrote the dmvnorm() function from the mvtnorm package with RcppEigen which is publised in http://gallery.rcpp.org/articles/dmvnorm_arma/. The code as follows: > #include > using namespace Rcpp; > // [[Rcpp::depends(RcppEigen)]] > //[[Rcpp::export]] > using Eigen::Map; > using Eige