<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 14, 2017 at 3:59 AM Serguei Sokol <<a href="mailto:serguei.sokol@gmail.com">serguei.sokol@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le 13/06/2017 à 18:24, Douglas Bates a écrit :<br>
> On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <<a href="mailto:binxiangni@gmail.com" target="_blank">binxiangni@gmail.com</a> <mailto:<a href="mailto:binxiangni@gmail.com" target="_blank">binxiangni@gmail.com</a>>> wrote:<br>
><br>
>     Hi,<br>
><br>
>     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<br>
>     Armadillo to R? That is, what should the result of wrap() be? dgCMatrix(if logical, lgCMatrix or ngCMatrix)  or their original type?<br>
><br>
><br>
> What do you mean by "their original type"?<br>
><br>
> It seems that the correspondence is<br>
> Armadillo           Matrix package<br>
> sp_mat       <=> dgCMatrix<br>
> sp_cx_mat <=> zgCMatrix<br>
> sp_imat      <=> igCMatrix<br>
I would also consider the format used in a package slam.<br>
It simply stores the indexes and non-zero values in a triplet (i,j,v).<br></blockquote><br></div><div class="gmail_quote">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.<br><br></div><div class="gmail_quote">I would point out that the sparse matrix facilities in Eigen and RcppEigen are much more extensive than those in Armadillo.<br></div></div>