Le 27/05/10 17:24, Vinh Nguyen a écrit :

Two questions:

1.  The main difference when using RcppArmadillo and Rcpp is the
header declaration and the return type for the function right?
extern "C" SEXP fastLm(SEXP ys, SEXP Xs) {}
RcppArmadillo takes this extern stuff whereas Rcpp takes RcppExport?
RcppExport SEXP newRcppVectorExample(SEXP vector) {}

RcppExport is a macro that expands to extern "C". so you can use the one you prefer, it makes no difference.

Many tutorials online explain what extern "C" means, and also writing R extensions.

2.  From the example, if I update the elements of X or Xr, then both
are updated correct?  Because they are pointing to the same thing.
Just want to make sure.  I'm dealing with both since Xr is used to
deal with some R objects, and X is used to do matrix multiplication,
etc.
arma::mat X(Xr.begin(), n, k, false);       // reuses memory and
avoids extra copy
arma::colvec y(yr.begin(), yr.size(), false);

using this constructor of arma::mat, X only borrows the memory of Xr.

So when you update one, the other is also updated. see the documentation of armadillo.

Thanks.
Vinh


--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/cork4b : highlight 0.1-8
|- http://bit.ly/bklUXt : RcppArmadillo 0.2.1
`- http://bit.ly/936ck2 : Rcpp 0.8.0


_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to