[Rcpp-devel] List of matrices mimicking 3d array?
Edward Wallace
ewjwallace at gmail.com
Thu Nov 10 00:19:44 CET 2011
Dear All,
I have just started using Rcpp and found it very useful. A step of my
calculation would naturally be done in a 3D array, and am trying to
work around this. May I gently make a feature request for Rcpp::array?
My workround idea involves trying to use lists of matrices. Since it
is array-like, I would like to initialize a list with many matrices of
the same size. Many for my problem means between 6 and ~100. I can do
this like so:
listcreate <- cxxfunction( signature(),'
NumericMatrix m(3,5);
List mmm = List::create(m,m,m,m) ;
return wrap(mmm);
', plugin= "Rcpp")
But this requires the number of entries to be hard-coded. Really I
would like to do something more like:
listcreatebetter <- cxxfunction( signature(),'
NumericMatrix m(3,5);
List mmm = List::createclones(4,m) ;
return wrap(mmm);
', plugin= "Rcpp")
which of course does not work.
Is there an easy way to do that? Or is there a native C++ class I
could use to skirt the issue?
This is my first post on the list and so I approach with some trepidation.
Thanks,
Edward
--
Edward Wallace, PhD
Harvard FAS center for Systems Biology
+1-773-517-4009
More information about the Rcpp-devel
mailing list