> I have developed a function that builds a series of vectors and a matrix > of undetermined size. ?Rather than attempt dynamic objects (which I > wouldn't know how to do anyway) I have been able to initialize with row > dimensions that cannot be exceeded on these objects.
If this is your goal, I recommend an alternate method -- RcppArmadillo. It offers resizing (e.g. http://arma.sourceforge.net/docs.html#set_size ). There are several ways to do this with Armadillo, depending on whether the memory of the object gets preserved or not. Note that you need to wrap() arma objects before, for example, putting them in lists (i think) or returning them to R. Something like this should get you started: require(RcppArmadillo) src = ' mymat = arma::mat(2, 2); //find dims of mymat, put them in vars nrow and ncol mymat.set_size(nrow, ncol); // do things return wrap(mymat); ' fun = cxxfunction('', src, plugin='RcppArmadillo') As an aside, are you *sure* that you can't allocate after computing the size? I'm with Douglas in the confused camp :) After all, much of Rcpp's magic is via templates, which make objects a lot more dynamic than you might expect (if you're come from, for example, a fortran background). -Christian _______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
