[Rcpp-devel] accessing list elements without using names
sameersoi at gmail.com
Fri Feb 10 20:49:33 CET 2012
I want to access a List of matrices in an Rcpp/C++ function that will
passed to me via R...
src <- "
using namespace Rcpp ;
List inputList(L) ;
NumericMatrix tmpMatrix ;
tmpMatrix = NumericMatrix(inputList) ;
test <- cxxfunction(signature(L="list"), src, plugin = "Rcpp" )
This gives me the following error-
file30b9664194fc.cpp: In function ‘SEXPREC* file30b9664194fc(SEXPREC*)’:
file30b9664194fc.cpp:34: error: call of overloaded
‘Matrix(Rcpp::internal::generic_proxy<19>)’ is ambiguous
/usr/share/R/include/Rcpp/vector/SubMatrix.h:57: note: candidates are:
Rcpp::Matrix<RTYPE>::Matrix(const Rcpp::SubMatrix<RTYPE>&) [with int RTYPE
Rcpp::Matrix<RTYPE>::Matrix(const Rcpp::Matrix<RTYPE>&) [with int RTYPE =
Rcpp::Matrix<RTYPE>::Matrix(const int&) [with int RTYPE = 14]
Rcpp::Matrix<RTYPE>::Matrix(const Rcpp::Dimension&) [with int RTYPE = 14]
Rcpp::Matrix<RTYPE>::Matrix(SEXPREC*) [with int RTYPE = 14]
make: *** [file30b9664194fc.o] Error 1
In looking at the error, it's not clear to me how these candidates will
help. What am I missing in telling Rcpp what class of object it should be
expecting coming out of inputList?
I know this kind of question (i.e. I want a 3d cube etc) pops up frequently
and the answer is typically "use arma's 3d cubes" (e.g.
but I don't intend on doing linear algebra. My data really is just a series
of matrices of arbitrary sizes.
Also, I looked into multi-dimensional arrays, but how to access them seems
unclear; I did see a post on this list to that nature but the solution
Thanks in advance for any help!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rcpp-devel