Skip to content
Prev 3086 / 10988 Next

[Rcpp-devel] can one modify array in R memory from C++ without copying it?

On Tue, Nov 1, 2011 at 9:11 PM,
<rcpp-devel-request at r-forge.wu-wien.ac.at> wrote:
3 quick points:

1:  For the NumericMatrix->arma, you can use an advanced constructor
to get the behavior that you desire.
http://arma.sourceforge.net/docs.html#Mat -- you'll want copy_aux_mem
= false.

2:  Are you actually doing matrix math?  If you're just doing simple
element-by-element arithmetic, you might get just as good performance
with a simple loop or iterator.  You might try this first to
understand the R/C++ process, and *then* move to using Armadillo :)

3:  For completeness, note that "Rcpp::NumericMatrix r_m(clone(mem));"
*forces* a copy, thus restoring R's "no side-effects" semantics.

-Christian

Thread (18 messages)

Christian Gunning can one modify array in R memory from C++ without copying it? Nov 1 andre zege can one modify array in R memory from C++ without copying it? Nov 1 Christian Gunning can one modify array in R memory from C++ without copying it? Nov 2 andre zege can one modify array in R memory from C++ without copying it? Nov 3 Darren Cook can one modify array in R memory from C++ without copying it? Nov 3 Darren Cook can one modify array in R memory from C++ without copying it? Nov 4 Romain Francois can one modify array in R memory from C++ without copying it? Nov 4 Darren Cook can one modify array in R memory from C++ without copying it? Nov 4 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 4 andre zege can one modify array in R memory from C++ without copying it? Nov 4 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 4 Steve Lianoglou can one modify array in R memory from C++ without copying it? Nov 4 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 4 Steve Lianoglou can one modify array in R memory from C++ without copying it? Nov 4 Douglas Bates can one modify array in R memory from C++ without copying it? Nov 4 Darren Cook can one modify array in R memory from C++ without copying it? Nov 6 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 6 Davor Cubranic can one modify array in R memory from C++ without copying it? Nov 6