[Rcpp-devel] Integrals with Rcpp

Dirk Eddelbuettel edd at debian.org
Fri Jan 9 15:38:56 CET 2015


On 9 January 2015 at 15:10, Federico Andreis wrote:
| Dear all,
| 
| I was wondering what, in your opinion, would be the best way to handle the
| computation of definite integrals using Rcpp.
| 
| To be more precise, I need to evaluate a double integral that turns out to be
| somewhat nasty (really slow computation and presumably inaccurate results using
| the R cubature package).
| 
| Should I write the integration algorithm from scratch, or is there any external
| library you would suggest?
| 
| I've already found the post on Stackoverflow 'using C function from other
| package in Rcpp' that dealt with an integration problem as well, but it looked
| too general for my problem and also, it's one year old, maybe something else
| has turned up in the meanwhile..

>From the top of my head, I think there are several CRAN package doing
something like cubature with related names.  It is not something I use day
to day so maybe somebody else will chime in...

In general, though, one (easy ?) approach is to solve the problem with
standalone C/C++ code [ possibly entirely outside of of R ] and then learn
(here and elsewhere) how to connect that to R via Rcpp. It is
straightforward.  

Alternatively, and starting from the other end, learn how to access C / C++
code in another package and do it with C++ code from R via Rcpp.

Or use the middle ground.  There are lots of ways in which Rcpp can help you here.

Dirk
 
| Thanks in advance, and congrats for the great work with Rcpp!
| 
| /federico
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list