[Rcpp-devel] replacing a splines ns() call with other Rcpp attached library function

Dirk Eddelbuettel edd at debian.org
Thu Jun 28 15:53:21 CEST 2012


On 28 June 2012 at 08:33, Douglas Bates wrote:
| On Thu, Jun 28, 2012 at 8:08 AM, Silkworth,David J.
| <SILKWODJ at airproducts.com> wrote:
| > Folks, I am bravely helping Gianluca Bonitta (a.k.a. bbonit at tin.it) develop
| > an Rcpp solution for his thesis, he already has a functioning R prototype.
| 
| > He has been using ns() from the splines library (thank-you Doug Bates!), and
| > we are interested in identifying an alternative call to one of the libraries
| > that are already available to Rcpp. GSL seemed most likely to me, but this
| > topic is a bit over my head, so I would appreciate some guidance.
| 
| Actually, I didn't write ns().  I only wrote the B-spline basis
| functions and evaluations.  There is C source code in
| $RSRC/library/splines/src/splines.c although it is not terribly easy
| to understand - I was in a "terser is better" phase when that was
| written.
| 
| You may find it easier to interface to some of the more recent C++
| libraries (e.g. libnurbs.sourceforge.net) for the evaluation.

Nice. And for what's it is worth, that is pretty much what I would do:

  a) fit a decent, modern, documented C++ implementation of what is needed

  b) write some simple, self-contained programs using it, while minimizing
     external dependencies

  c) and only then start to think about bringing it to R via Rcpp and
     possibly write a simple package.

and of course if a) fails, one can always 'rip out' what is underneath a
known R function and use that as a fallback.  There is also

  d) use black art tricks to access the R symbols which was documented here
     by Davor in his quest to access the C code which powers loess().

Dirk

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


More information about the Rcpp-devel mailing list