[Rcpp-devel] Slower sugar functions through Rcpp than R?

2017-02-21 Thread Eridk Poliruyt
Hi all, I am just starting using Rcpp to accelerate some computations. I need to evaluate some likelihood using common math functions like beta, lbeta, gamma, lgamma, choose, lchoose, etc. But I found that it could be even slower in Rcpp than R? Please see the example below using Rcpp.. // [[Rcpp

Re: [Rcpp-devel] Slower sugar functions through Rcpp than R?

2017-02-21 Thread Dirk Eddelbuettel
On 21 February 2017 at 11:12, Eridk Poliruyt wrote: | Hi all, |   | I am just starting using Rcpp to accelerate some computations. I need to | evaluate some likelihood using common math functions like beta, lbeta, gamma, | lgamma, choose, lchoose, etc. But I found that it could be even slower in R

[Rcpp-devel] Rcpp : passing user-defined c++ class

2017-02-21 Thread Yousra El Bachir
Hi all, I am calling from R (say funcR) a c++ function (say funcCpp) which needs either some programmer-defined c++ class (say programmerClassCpp1, 2, etc...) or a user-defined c++ class (say userClassCpp). Here is an illustration of what I am doing: funcR(..., class="ClassCpp"){ # do somethin

[Rcpp-devel] Using complex numbers and functions in Rcpp

2017-02-21 Thread Martin S Ridout
Apologies if this is a naive question - I'm a beginner with Rcpp. I did see some earlier discussion on similar topic, but I don't think it answered my questions. I am trying (on Windows) to speed up a function currently written in R. This works very well for real-valued arguments of the funct

Re: [Rcpp-devel] Using complex numbers and functions in Rcpp

2017-02-21 Thread Baptiste Auguie
Hi, I think you can/should use std::complex, see for example the types used in https://github.com/baptiste/rcppfaddeeva/blob/master/src/callFaddeeva.cpp In general I prefer to work with RcppArmadillo for numerical (including complex) computations, its syntax closely follows R and Matlab. See for

Re: [Rcpp-devel] Using complex numbers and functions in Rcpp

2017-02-21 Thread Dirk Eddelbuettel
On 22 February 2017 at 10:36, Baptiste Auguie wrote: | I think you can/should use std::complex, see for example the types used in | | https://github.com/baptiste/rcppfaddeeva/blob/master/src/callFaddeeva.cpp  | | In general I prefer to work with RcppArmadillo for numerical (including | complex)

Re: [Rcpp-devel] Rcpp : passing user-defined c++ class

2017-02-21 Thread Dirk Eddelbuettel
On 21 February 2017 at 14:15, Yousra El Bachir wrote: | I am calling from R (say funcR) a c++ function (say funcCpp) which needs either | some programmer-defined c++ class (say programmerClassCpp1, 2, etc...) or a | user-defined c++ class (say userClassCpp). Here is an illustration of what I am