Operating over an Rcpp::List of matrices with dense or sparse matrix types
I need to perform calculations for each matrix entry in an Rcpp::List
. The list contains an arbitrary combination of dense and sparse matrices. This list is passed to C++ from R. My question here concerns both approaches to implementation, and efficiency. My current thought is to loop over each element of the list, check for its type (dense or sparse) and generate an arma::mat
or arma::sp_mat
for the element, and use it for calculations, preferably without copying. I am confused about the following: