[Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix

Douglas Bates bates at stat.wisc.edu
Wed Jun 14 15:21:54 CEST 2017


On Wed, Jun 14, 2017 at 3:59 AM Serguei Sokol <serguei.sokol at gmail.com>
wrote:

> Le 13/06/2017 à 18:24, Douglas Bates a écrit :
> > On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <binxiangni at gmail.com
> <mailto:binxiangni at gmail.com>> wrote:
> >
> >     Hi,
> >
> >     I am working on fixing sparse matrix conversion for RcppArmadillo.
> Now a problem comes up to me: what kind of sparse matrix is expected to
> pass from
> >     Armadillo to R? That is, what should the result of wrap() be?
> dgCMatrix(if logical, lgCMatrix or ngCMatrix)  or their original type?
> >
> >
> > What do you mean by "their original type"?
> >
> > It seems that the correspondence is
> > Armadillo           Matrix package
> > sp_mat       <=> dgCMatrix
> > sp_cx_mat <=> zgCMatrix
> > sp_imat      <=> igCMatrix
> I would also consider the format used in a package slam.
> It simply stores the indexes and non-zero values in a triplet (i,j,v).
>

That is the format of the dgTMatrix class from the Matrix package for R but
not, as far as I can tell, in Armadillo.  A brief glance at the Armadillo
documentation indicates that sparse matrices are always in the compressed
sparse column (CSC) format.

I would point out that the sparse matrix facilities in Eigen and RcppEigen
are much more extensive than those in Armadillo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20170614/bc4c3163/attachment.html>


More information about the Rcpp-devel mailing list