[Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)
Dirk Eddelbuettel
edd at debian.org
Tue Sep 11 04:38:28 CEST 2012
On 10 September 2012 at 22:42, Anthony Lee wrote:
| On 10/09/12 22:05, Dirk Eddelbuettel wrote:
| >
| > I didn't have a lot of time for your post but I suspect your design is broken
| > if you plan to call an R function in each itereation of a C++ loop.
| >
| > Just because you can does not mean you should.
| >
| > Dirk
| >
|
| In fact, there are some good reasons for doing so, amongst them being
| the ability to play around with exactly those functions while leaving
| the rest of the code untouched. Naturally, calling C++ functions
| directly would be faster, and I was planning on trying to allow for
| Rcpp::XPtr's to be passed in for special cases, but speed is not the
| overriding design principle here, not least because I have other
| projects that focus exclusively on speed. It is also the case that a
| significant amount of compute will be done in those functions in general
| (whether they are implemented in C++ or not), so the overhead is not an
| issue.
|
| In any case, if I have made a mistake and it is possible to ensure the
| safety of the R function call, then I would be glad to hear how I can
| correct it.
One thing I would do differently is avoid use of '_' as a range / column
selector.
If you must do what you are doing, try doing it on straight vectors which
should reduce the need for temoraries.
Good luck, Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list