[Rcpp-devel] Very Large Matrices in RcppArmillao

Christian Gunning xian at unm.edu
Tue Jul 17 10:08:08 CEST 2012

On Tue, Jul 17, 2012 at 12:50 AM, Christian Gunning
<icos.atropa at gmail.com> wrote:
> On Mon, Jul 16, 2012 at 10:30 PM,
> <rcpp-devel-request at lists.r-forge.r-project.org> wrote:
>> 2.  I have found in the past that some of the speeds gains from RcppArmadillo in comparison to pure R are lost when passing large matrices as arguments.  There will always be overhead when passing arguments (especially large matrix arguments) to pretty much any function.  Are there any tricks to minimize the overhead when passing a non-sparse matrix argument of say 1,000,000 by 500 from R to Armadillo?

 Yes, at the expense of R's "inherently safe" pass-by-value semantics.
 Armadillo allows pass-by-reference semantics with advanced
 constructors.  Just be aware of the risks...

 http://arma.sourceforge.net/docs.html#Mat -- you'll want copy_aux_mem = false.

 There's a good thread on this here:

<sent to list via wrong email address>
 A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!

More information about the Rcpp-devel mailing list