[Rcpp-devel] Step-by-Step Plan to Code Writing and Testing with Rcpp, RcppGSL or RcppArmadillo

Dirk Eddelbuettel edd at debian.org
Thu Dec 9 02:57:15 CET 2010


On 8 December 2010 at 17:44, Savitsky, Terrance wrote:
| I?m having difficulty to find ?How-to? documentation;  the papers and
| presentations (including the RcppExamples package) are exciting, but focus on
| marketing use, 

Nice way to start a dialogue with us by telling us we're idiots. Keep going.

| rather than providing instructions.   I?d appreciate any help to
| get started to:
|
| 1.       Code C++ using the Rcpp, RcppGSL and RcppArmadillo libraries.  

I don't know how many example we posted on blogs, this list and in
presentations. Exactly which did not work?
 
| a.       May I link my IDE (netbeans) to the lib.a files and use the
| appropriate .h files for composing C++ code for compilation in R? 

Don't know, don't care.  Ex-ant this is for __R__ where the command is 'R CMD ...'
and/or Makefiles.

If you need netbeans, you get to figure out netbeans. Exiciting to be trailblazer, eh?

| b.      Do RcppGSL and RcppArmadillo contain the Rcpp classes or should the
| header files from both be included (e.g. #include Rcpp.h, #include
| RcppArmadillo.h)

Have you looked at the examples. They work, and they provide the anwwer.
 
| c.       The matrix and vector classes, including views, Rcpp implementation of
| the C library GSL employs new C++ capabilities and different syntax (e.g.
| extraction of pointers from matrix or vector view objects).  Is there detailed
| documentation with examples for these class implementations.  The differences
| from GSL disable using that documentation.

I have no idea what you are trying to say here. You are mixing two core APIs
(Views in Rcpp only exist in the classic API) and two 'glued-on' libraries
one of which is C --- so there are bound to differences.

| d.      Should RcppExport be used in place of ?extern C? in C++ under Rcpp
| whenever we wish to input R data types such as matrix, vector and list (due to
| need to call .Call)?

Look at the definiton and decide for yourself. Using the define has the
advantage that should we ever change it ...

| 2.       Compile and debug code using Inline or other preferred alternatives.
| 
| a.       The illustrations in presentations seem to copy and paste the entire
| code from C++ in single quotes with an assignment to a variable subsequently
| used with inline in R.  My code (a Bayesian MCMC implementation) will be on the
| order of 600 lines long with about 10 input variables.  Is there a better way
| to use inline?

Up to you. Inline is for experimentation. We had a MCMC example on the list
following Whit's question. Did you look at it?

| b.      Is there any help on code debugging?  (e.g. some equivalent of ?gdb?).

How could there not be debugging support with gdb if g++ is used?
 
| 3.       Writing a package.

Seen the Vignette?
 
| a.       What is the ?LinkingTo? declaration ? what purpose does it serve and
| where is it used? 
| 
| b.      Same for Makevars and Makevars.win?

See 'Writing R Extensions' 

Dirk


| Thanks, Terrance Savitsky
| 
|  
| 
| 
| __________________________________________________________________________
| 
| This email message is for the sole use of the intended recipient(s) and
| may contain confidential information. Any unauthorized review, use,
| disclosure or distribution is prohibited. If you are not the intended
| recipient, please contact the sender by reply email and destroy all copies
| of the original message.
| 
| ----------------------------------------------------------------------
| _______________________________________________
| 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

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


More information about the Rcpp-devel mailing list