[Rcpp-devel] Limit of 20 on length of Rcpp::List::create?

2011-11-01 Thread Michael Hannon
Greetings.  It appears that there is a limit of 20 items in a list created by;     Rcpp::List:create I.e., the appended code works as expected if I omit all references to "x21", but fails with an error (shown below, after the code example) when I include "x21".  (The successful output shown bel

Re: [Rcpp-devel] Limit of 20 on length of Rcpp::List::create?

2011-11-01 Thread Douglas Bates
On Tue, Nov 1, 2011 at 3:32 PM, Michael Hannon wrote: > > > Greetings.  It appears that there is a limit of 20 items in a list created by; > >     Rcpp::List:create > > I.e., the appended code works as expected if I omit all references to "x21", > but fails with an error (shown below, after the co

Re: [Rcpp-devel] Limit of 20 on length of Rcpp::List::create?

2011-11-01 Thread Tama Ma
Hi, I recommend the following workaround instead... std::vector _your_favorite_list; _your_favourite_list.push_back(_whatever_); _your_favourite_list.push_back(_whatever_); _your_favourite_list.push_back(_whatever_); _your_favourite_list.push_back(_whatever_); _your_favourite_list.push_back(_wha

[Rcpp-devel] Unable to install SVN r3262 of Rcpp

2011-11-01 Thread Douglas Bates
I have installed the int64 package using the sources from the SVN repository and now I get $ R-patched CMD INSTALL -c --byte-compile ~/sloc/Rcpp * installing to library ‘/home/bates/R/x86_64-unknown-linux-gnu-library/2.14’ * installing *source* package ‘Rcpp’ ... ** libs ccache g++ -I/home/bates/

Re: [Rcpp-devel] Have I noticed memory management bug in RcppArmadillo or is this the intended behaviour?

2011-11-01 Thread Davor Cubranic
Cool, glad to have gotten down to the bottom of this. Davor On October 30, 2011 08:48:10 PM Slava Razbash wrote: > Drik, Davor, > > I don't think that what I was observing was a memory leak. > > I have ran the functions provided by Dirk. I have also used gc() as > suggested by Davor. The memor

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

2011-11-01 Thread andre zege
Hi, guys. I have some pretty large arrays in R and i wanted to do some time consuming modifications of these arrays in C++ without actually copying them, just by passing pointers to them. Since i don't know internal data structures of R, i am not sure it's possible, but i thought it was. Here is so

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

2011-11-01 Thread Dirk Eddelbuettel
On 1 November 2011 at 20:59, andre zege wrote: | Hi, guys. I have some pretty large arrays in R and i wanted to do some time | consuming modifications of these arrays in C++ without actually copying them, | just by passing pointers to them. Since i don't know internal data structures | of R, i am

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

2011-11-01 Thread andre zege
Dirk, apologies, i meant to sent it to R-devel, i just replied to wrong list. Now that i read responses on both lists, i am confused. Simon Urbanek seemed to indicate that call by reference from R to C++ is impossible with .C interface and dangerous and unreliable with .Call. If i understood you co

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

2011-11-01 Thread Slava Razbash
Andre, You should compare your code with a working RcppArmadillo example, such as the one on Dirk's website: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html "Writing R Extensions" descirbes the .Call() interface and the R API. When using .Call(), it does not make copies of the objects passed

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

2011-11-01 Thread andre zege
Slava, thanks for your pointers. I changed the code to the way Dirk example goes, namely -- #include RcppExport void modify(SEXP mem){ Rcpp::NumericMatrix r_m(mem); arma::mat m(r_m.begin(), r_m.nrow(), r_m.ncol(), false); m.print(); m=m+

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

2011-11-01 Thread Christian Gunning
On Tue, Nov 1, 2011 at 9:11 PM, wrote: > >> .Call("modify", m) >> m >     [,1] [,2] [,3] [,4] [,5] > [1,]    1    3    5    7    9 > [2,]    2    4    6    8   10 > > > It didn't segfault, but the memory in R process didn't change as you see, > although the matrix in armadillo code doubled. Which

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

2011-11-01 Thread andre zege
Christian, 1. in my previous post i used exactly that same constructor you are talking about as you can see from the code i posted 2. i am not doing any math in this illustrative example, i am just modifying a toy matrix and showing that this modification didn't propagate back to R. Which means