[Rcpp-devel] Lots of lists

Romain Francois romain at r-enthusiasts.com
Tue Mar 13 19:57:16 CET 2012


Le 13/03/12 19:18, Matthew Krachey a écrit :
> Hi,
>
> I am working on a rather complicated MCMC simulation with a lot of return objects, both vectors and matrices. We are on the verge of getting things to go (to date, much faster than Numpy) but we are returning ~21 list objects (again, both vectors and matrices) and we are getting error when the 21st object is added. We would like all of this output to return to R for post-processing. Is there a recommended way to deal with this type of output?
>
> Thanks
>
> Matthew

I'm assuming you are using List::create to create your list with 20+ 
elements. In that case, you hit the limit of our code bloat.

In the absence of a proper way to deal with variable number of arguments 
(as offered in the C++11 standard with variadic templates), we had to 
semi-manually generated these.
https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/inst/include/Rcpp/generated/Vector__create.h?view=markup&revision=3451&root=rcpp

It would be possible to keep it up and pump it to say 30, 50, whatever, 
but you could also consider organising the information differently.

What are these lists ? Do you need them to be next to each other or can 
you do it differently ?

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
R Graph Gallery: http://addictedtor.free.fr/graphiques
blog:            http://romainfrancois.blog.free.fr
|- http://bit.ly/xbKv0R : Crawling facebook with R
|- http://bit.ly/v3WB8S : ... And now for solution 17, still using Rcpp
`- http://bit.ly/uaQDGr : int64: 64 bit integer vectors for R


More information about the Rcpp-devel mailing list