Discussion:
[Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix
Binxiang Ni
2017-06-13 15:55:40 UTC
Permalink
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?

If you are familiar with sparse matrix, please do me a favor.

Best,
Binxiang
Douglas Bates
2017-06-13 16:24:28 UTC
Permalink
Post by Binxiang Ni
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

After that you are going to need to convert the values vector in the
Armadillo representation to a datatype available in R. (In fact there is
always an implicit conversion because the rowind and colptr vectors are
unsigned integers in Armadillo and integers in R. However that change is
just a cast of a pointer.)

I wouldn't worry about the logical values because LOGICAL in R is just a
32-bit integer. ngCMatrix in R is a pattern matrix which only stores the
positions of the non-zeros, not their values. These are used in the
symbolic phase of many sparse matrix operations, particularly
decompositions. The symbolic phase only uses the pattern of nonzeros. It
doesn't appear that there is a corresponding type in Armadillo.
Serguei Sokol
2017-06-14 09:00:11 UTC
Permalink
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).

Serguei.
Douglas Bates
2017-06-14 13:21:54 UTC
Permalink
Post by Binxiang Ni
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
Post by Binxiang Ni
Armadillo to R? That is, what should the result of wrap() be?
dgCMatrix(if logical, lgCMatrix or ngCMatrix) or their original type?
Post by Binxiang Ni
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.
Serguei Sokol
2017-06-14 14:06:58 UTC
Permalink
Post by Serguei Sokol
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.
Indeed, but nothing prevents Binxiang to develop a wrap() that will convert
armadillo format to one or many of R formats, right?
Douglas Bates
2017-06-14 15:33:05 UTC
Permalink
Post by Serguei Sokol
Post by Dirk Eddelbuettel
On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <
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
Post by Serguei Sokol
Post by Dirk Eddelbuettel
Armadillo to R? That is, what should the result of wrap() be?
dgCMatrix(if logical, lgCMatrix or ngCMatrix) or their original type?
Post by Serguei Sokol
Post by Dirk Eddelbuettel
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).
Post by Serguei Sokol
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
Post by Serguei Sokol
documentation indicates that sparse matrices are always in the
compressed sparse column (CSC) format.
Indeed, but nothing prevents Binxiang to develop a wrap() that will convert
armadillo format to one or many of R formats, right?
Why? Is there a reason for doing type conversion from the dgCMatrix format
to another format in an Rcpp wrap function instead of with the existing
functions from the Matrix package?

Bear in mind that dgCMatrix is an efficient format both in terms of the
amount of memory required (that's the "compressed" part of the name) and
in terms of performing operations with the matrix. Most operations on
sparse matrices stored in the triplet format start by creating a CSC or CSR
(compressed sparse row) form of the matrix anyway.
Serguei Sokol
2017-06-14 15:55:49 UTC
Permalink
Post by Binxiang Ni
Post by Serguei Sokol
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
Post by Serguei Sokol
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.
Indeed, but nothing prevents Binxiang to develop a wrap() that will convert
armadillo format to one or many of R formats, right?
Why?
Sure, Matrix is very versatile and rich in features but the price for this is its heavy weight.
Post by Binxiang Ni
system.time(library(Matrix))
utilisateur système écoulé
1.427 0.052 1.619

I don't have my laptop here but the load time can be longer.
Post by Binxiang Ni
system.time(library(slam))
utilisateur système écoulé
0.012 0.000 0.011
When slam can suffice, why not to use it?
Post by Binxiang Ni
Is there a reason for doing type conversion from the dgCMatrix format to another format in an Rcpp wrap function instead of with the existing functions
from the Matrix package?
Bear in mind that dgCMatrix is an efficient format both in terms of the amount of memory required (that's the "compressed" part of the name) and in terms of
performing operations with the matrix. Most operations on sparse matrices stored in the triplet format start by creating a CSC or CSR (compressed sparse row)
form of the matrix anyway.
In Matrix package, I presume?
Few basic operations that I have seen in slam, stay with triplet format.
So if a user did not load Matrix package and want to use e.g. slam format,
it would be great if wrap() could give him expected format.
Serguei Sokol
2017-06-15 09:38:34 UTC
Permalink
Post by Serguei Sokol
Post by Serguei Sokol
...
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.
Indeed, but nothing prevents Binxiang to develop a wrap() that will convert
armadillo format to one or many of R formats, right?
I realize that I was asking too much to wrap(). After having a glance on
http://gallery.rcpp.org/articles/custom-templated-wrap-and-as-for-seamingless-interfaces/
I understand that it cannot convert a given object to more than one R format.
There is no mechanism equivalent to T as in as<T>().
Given this, I agree that the most logical solution would be to stay with
CSC format which is common to Armadillo and Matrix package.

Dirk Eddelbuettel
2017-06-14 14:01:30 UTC
Permalink
On 14 June 2017 at 11:00, Serguei Sokol wrote:
| Le 13/06/2017 à 18:24, Douglas Bates a écrit :
| > On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <***@gmail.com <mailto:***@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).

There is more here: https://en.wikipedia.org/wiki/Sparse_matrix

But it would probably be good to hear from some actual users of sparse
matrices such as Doug (thanks for piping in already!), Soren or anybody else
with exposure to sparse matrices, ideally via CRAN packages we can wire up
for testing.


Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Dmitriy Selivanov
2017-06-14 16:44:55 UTC
Permalink
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).

And last my observation - I agree with Doug that it seems that Eigen has
much stronger support for operations with sparse matrices.

14 ОюМ. 2017 г. 19:55 пПльзПватель <rcpp-devel-***@lists.r-
forge.r-project.org> МапОсал:

Send Rcpp-devel mailing list submissions to
rcpp-***@lists.r-forge.r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo
/rcpp-devel

or, via email, send a message with subject or body 'help' to
rcpp-devel-***@lists.r-forge.r-project.org

You can reach the person managing the list at
rcpp-devel-***@lists.r-forge.r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Rcpp-devel digest..."


Today's Topics:

1. Re: [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix
(Douglas Bates)
2. Re: [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix
(Dirk Eddelbuettel)
3. Re: [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix
(Serguei Sokol)
4. Re: [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix
(Douglas Bates)
5. Re: [RcppArmadillo] Result of Rcpp Wrap() for Sparse Matrix
(Serguei Sokol)


----------------------------------------------------------------------

Message: 1
Date: Wed, 14 Jun 2017 13:21:54 +0000
From: Douglas Bates <***@stat.wisc.edu>
To: ***@gmail.com, Binxiang Ni <***@gmail.com>,
rcpp-***@lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for
Sparse Matrix
Message-ID:
<CAO7JsnTo8bA6LTsHz0udyjF-KAaE2kp-rKb13tyudg6gV=***@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Post by Binxiang Ni
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
Post by Binxiang Ni
Armadillo to R? That is, what should the result of wrap() be?
dgCMatrix(if logical, lgCMatrix or ngCMatrix) or their original type?
Post by Binxiang Ni
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-0001.html>

------------------------------

Message: 2
Date: Wed, 14 Jun 2017 09:01:30 -0500
From: Dirk Eddelbuettel <***@debian.org>
To: ***@gmail.com
Cc: rcpp-***@lists.r-forge.r-project.org, Binxiang Ni
<***@gmail.com>
Subject: Re: [Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for
Sparse Matrix
Message-ID: <***@max.eddelbuettel.com>
Content-Type: text/plain; charset=iso-8859-1


On 14 June 2017 at 11:00, Serguei Sokol wrote:
| Le 13/06/2017 ? 18:24, Douglas Bates a ?crit :
| > On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <***@gmail.com
<mailto:***@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).

There is more here: https://en.wikipedia.org/wiki/Sparse_matrix

But it would probably be good to hear from some actual users of sparse
matrices such as Doug (thanks for piping in already!), Soren or anybody else
with exposure to sparse matrices, ideally via CRAN packages we can wire up
for testing.


Dirk

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


------------------------------

Message: 3
Date: Wed, 14 Jun 2017 16:06:58 +0200
From: Serguei Sokol <***@gmail.com>
To: Douglas Bates <***@stat.wisc.edu>, Binxiang Ni
<***@gmail.com>, rcpp-***@lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for
Sparse Matrix
Message-ID: <1ade20d8-f08c-df7b-e147-***@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Post by Binxiang Ni
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
Post by Binxiang Ni
Armadillo to R? That is, what should the result of wrap() be?
dgCMatrix(if logical, lgCMatrix or ngCMatrix) or their original type?
Post by Binxiang Ni
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.
Indeed, but nothing prevents Binxiang to develop a wrap() that will convert
armadillo format to one or many of R formats, right?


------------------------------

Message: 4
Date: Wed, 14 Jun 2017 15:33:05 +0000
From: Douglas Bates <***@stat.wisc.edu>
To: ***@gmail.com, Binxiang Ni <***@gmail.com>,
rcpp-***@lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for
Sparse Matrix
Message-ID:
<CAO7JsnT7cj3pAqF7rEJ-EV_qke+***@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Post by Binxiang Ni
Post by Dirk Eddelbuettel
On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <
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
Post by Binxiang Ni
Post by Dirk Eddelbuettel
Armadillo to R? That is, what should the result of wrap() be?
dgCMatrix(if logical, lgCMatrix or ngCMatrix) or their original type?
Post by Binxiang Ni
Post by Dirk Eddelbuettel
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).
Post by Binxiang Ni
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
Post by Binxiang Ni
documentation indicates that sparse matrices are always in the
compressed sparse column (CSC) format.
Indeed, but nothing prevents Binxiang to develop a wrap() that will
convert
armadillo format to one or many of R formats, right?
Why? Is there a reason for doing type conversion from the dgCMatrix format
to another format in an Rcpp wrap function instead of with the existing
functions from the Matrix package?

Bear in mind that dgCMatrix is an efficient format both in terms of the
amount of memory required (that's the "compressed" part of the name) and
in terms of performing operations with the matrix. Most operations on
sparse matrices stored in the triplet format start by creating a CSC or CSR
(compressed sparse row) form of the matrix anyway.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/
attachments/20170614/7a9fef46/attachment-0001.html>

------------------------------

Message: 5
Date: Wed, 14 Jun 2017 17:55:49 +0200
From: Serguei Sokol <***@gmail.com>
To: Douglas Bates <***@stat.wisc.edu>, Binxiang Ni
<***@gmail.com>, rcpp-***@lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] [RcppArmadillo] Result of Rcpp Wrap() for
Sparse Matrix
Message-ID: <4cbe9f66-6755-70bc-3a59-***@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Post by Binxiang Ni
On Wed, Jun 14, 2017 at 3:59 AM Serguei Sokol <
Post by Dirk Eddelbuettel
On Tue, Jun 13, 2017 at 10:56 AM Binxiang Ni <
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
Post by Binxiang Ni
Post by Dirk Eddelbuettel
Armadillo to R? That is, what should the result of
wrap() be? dgCMatrix(if logical, lgCMatrix or ngCMatrix) or their original
type?
Post by Binxiang Ni
Post by Dirk Eddelbuettel
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).
Post by Binxiang Ni
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
Post by Binxiang Ni
documentation indicates that sparse matrices are always in the
compressed sparse column (CSC) format.
Indeed, but nothing prevents Binxiang to develop a wrap() that will
convert
armadillo format to one or many of R formats, right?
Why?
Sure, Matrix is very versatile and rich in features but the price for this
is its heavy weight.
It can take several seconds to load it up. On my rather mighty PC (Intel
system.time(library(Matrix))
utilisateur syst?me ?coul?
1.427 0.052 1.619

I don't have my laptop here but the load time can be longer.
system.time(library(slam))
utilisateur syst?me ?coul?
0.012 0.000 0.011
When slam can suffice, why not to use it?
Is there a reason for doing type conversion from the dgCMatrix format to
another format in an Rcpp wrap function instead of with the existing
functions
from the Matrix package?
Bear in mind that dgCMatrix is an efficient format both in terms of the
amount of memory required (that's the "compressed" part of the name) and
in terms of
performing operations with the matrix. Most operations on sparse
matrices stored in the triplet format start by creating a CSC or CSR
(compressed sparse row)
form of the matrix anyway.
In Matrix package, I presume?
Few basic operations that I have seen in slam, stay with triplet format.
So if a user did not load Matrix package and want to use e.g. slam format,
it would be great if wrap() could give him expected format.


------------------------------

_______________________________________________
Rcpp-devel mailing list
Rcpp-***@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

End of Rcpp-devel Digest, Vol 92, Issue 12
******************************************
Dirk Eddelbuettel
2017-06-14 17:31:43 UTC
Permalink
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 | ***@debian.org
Loading...