[Rcpp-devel] Fwd: Rcpp RMpfr mpreal to mpfr wrapping

Dirk Eddelbuettel edd at debian.org
Mon Nov 19 00:49:12 CET 2012


On 18 November 2012 at 15:04, Thell Fowler wrote:
| When you say we get the whole SEXP and can 'access' it, that doesn't mean we
| can setup a template type against it for 'wrap' and 'as' though; right?  If
| so, can you think of a reference for me?

Generally speaking you template on types the compiler knows, eg C++ base
types, classes you have declared etc pp -- where SEXP it a pointer to C
struct so don't really get template dispatching.  Hence
       Rcpp::as<someType>(SEXPvar) 
as we need someType's info

| Yep the POC looks good so far, I'm _very_ pleased with the timing results.
|  The actual question is _how_ to template the wrapping of an <mpfr1> to
| <mpfr>.  Right now each individial <mpfr1> is wrapped to an individual <mpfr>
| which is wrong as an <mpfr> is an actual list of <mpfr1> objects in "R", yet as
| soon as the Rcpp::wrap<mpreal> is called I don't see how to state the <T> of
| the SEXP.

I would suggest to not obsess over template design and possibly just get
something going with mpfr1 which you can the manually stick into an mpfr in a
helper function.

Get it working first, make it fancy thereafter. And remember that step 2 is optional.

Dirk

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


More information about the Rcpp-devel mailing list