[Rcpp-devel] Question regarding Rcpp/RcppArmadillo and Rcpp/sugar

Dirk Eddelbuettel edd at debian.org
Mon Jul 16 19:57:03 CEST 2012


Hi Venelin,

Thanks for posting here.

On 16 July 2012 at 19:46, Venelin Mitov wrote:
| Hi,
| 
| I am trying to use Rcpp for translating an R program in C++. There seems to be
| some redundancy in the functionality provided by RcppArmadillo and pure Rcpp,
| for example, one can use arma::vec instead of NumericVector and arma::mat
| instead of NumericMatrix. And it is possible to evaluate algebraic expressions
| with both classes. If I understand correctly, RcppArmadillo relies on
| overloaded operators for the arma:: classes (+,-, *...). On the other hand,
| these operations are made possible with NumericMatrix with sugar, right?

Yes and no. Sugar support is still limited for operations.  

And you do have a choice of two class libraries and interface packages for linear
algebra and more: RcppArmadillo, and RcppEigen. 
  
| So my question is: Is there a rule of thumb to choose between one or another
| implementation?

I tend to use the Armadillo objects whenever I want to do actual linear
algebra, and stick with the Rcpp vector and matrix classes when I just need,
for lack of a better term, "storage containers" to collect data and/or pass
it around to other libraries or functions.  

As for Rcpp and sugar: further contributions would be welcome. But this
requires pretty solid skills with C++ templates...

Hope this helps!

Cheers, Dirk


| 
| Cheers,
| Venelin
| 
| 
| 
| ----------------------------------------------------------------------
| _______________________________________________
| 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