Skip to content
Prev 4898 / 10988 Next

[Rcpp-devel] Sparse matrices with RcppArmadillo

On Sat, Dec 8, 2012 at 10:35 AM, c s <conradsand.arma at gmail.com> wrote:

            
dgCMatrix objects also use compressed sparse column format with zero-based
indices so it is likely that it would only be necessary to copy the
contents of the arrays of column pointers (the "p" slot), row indices (the
"i" slot) and values of the non-zeros (the "x" slot).  It may even be
possible to just map the pointers for a read-only sparse matrix.

Romain:
 In general it is very slow to insert non-zero elements into this format.
 In the worst case the entire structure must be copied and extended for
each insertion.  We have to keep telling people about this when they tell
us that sparse matrices in R are so slow to work with.

 You have seen what the layout of a dgCMatrix is so it is only necessary to
find the desired components of a arma::sp_mat object.  I'll take a look
once I get some things installed.  If it is desirable the as and wrap
methods for the Eigen::SparseMatrix<T> and Eigen::MappedSparseMatrix<T>
classes should be fairly easy to adapt for arma::sp_mat class.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121208/bb116647/attachment.html>