[Rcpp-devel] redimension help

Dirk Eddelbuettel edd at debian.org
Wed Jun 8 05:58:31 CEST 2011


David,

One last thing: you are trying something difficult with large
multi-dimensional objects.

I really recommend that you try to become more familiar with a more STL-ish
way of doing things. Try something simpler on std::vector<> et al -- how you
can change dimension, expand, remove, ... without _ever_ having to worry
about manual memory allocation via new / delete (or, worse, malloc /
free). That is a good thing.  If you really know the size of objects, try
reserve() or size().

Our Rcpp objects are pretty similar in some aspects, but because they really
shadow the underlying R objects (those SEXPs) they are still different.  It
takes some getting used, and I have no better recommendation than to read
more documentation and working code -- there are 20+ packages on CRAN using
Rcpp.  You may find something close to your needs for closer study.

Hope this helps, Dirk

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com


More information about the Rcpp-devel mailing list