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

Dirk Eddelbuettel edd at debian.org
Wed Jun 14 19:31:43 CEST 2017


On 14 June 2017 at 20:44, Dmitriy Selivanov wrote:
| My 2 cents. Last couple of years I used sparse matrices a lot. Matrix package
| is really great. I'm not sure I understand issue with wrapping - as Doug said
| CSC format is main in both Armadillo and Matrix. Given matrix in CSC format
| (dgCMatrix/CsparseMatrix) it is trivial to convert it to COO or CSR with as(x,
| "TsparseMatrix") / as(x, "RsparseMatrix").
| 
| Second point is about slam package and COO format. I didn't use it, but used
| scipy, Armadillo, Eigen. And none of these packages use COO format for
| operations on matrices... I doubt it could be efficient.
| 
| Third point is that I have feeling that nowadays CSR format is more mainstream.
| For instance Eigen implements multithreaded sparse - dense multiplications and
| sparse solvers (https://eigen.tuxfamily.org/dox/TopicMultiThreading.html). Same
| story about sparse BLAS with Intel MKL - it works with CSR matrices. I realize
| that CSR = transposed CSC, but still it is not convenient to transpose mind
| each time. (Would be great to add more support for CSR matrices, but this is
| out of scope of this discussion).

Really nice summary, and very helpful because ...
 
| And last my observation - I agree with Doug that it seems that Eigen has much
| stronger support for operations with sparse matrices.

... this year we have Binxiang trying to get (Rcpp)Armadillo closer to
(Rcpp)Eigen in terms of sparse matrix support.  It is a valid goal because
many of really like Armadillo yet have more needs for sparse matrix support
with Armadillo and eg MLPACK or other things built on top of Armadillo.

I also want to add that the load-time critique with respect to Matrix hits
more on whether S4 is a good or bad idea (and for something as complex and
feature-rich as Matrix it is almost certainly a good one) and has little to
do with the representation of sparse matrix indices.

Dirk

PS Please consider removing quoted text. This message I am replying to
exceeded the size limit so I had to manually approve it (and I also
incremented the limit from the old, small default, but still...)

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list