[Rcpp-devel] Sparse matrix operations

Douglas Bates bates at stat.wisc.edu
Mon Feb 3 19:59:36 CET 2014


On Mon, Feb 3, 2014 at 11:48 AM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 3 February 2014 at 10:23, French, Joshua wrote:
> | Soren and Doug,
> |
> | Thanks for the info about the sparse matrices.  I'll give it a go and
> seen what
> | happens.  If it works out, then perhaps I'll be able to provide a nice
> | RcppGallery example.
>
> Yes -- there isn't much yet in RcppArmadillo but this is expected to
> grow. And CRAN now has rARPACK so we get cheaply to the object code too.
>
> One last comment I should have made earlier: "dense" data from R comes over
> cheaply as a SEXP; "sparse" will always require a copy.  Keep that in mind,
> and on the margin don't believe anything any of us say but keep profiling
> and
> measuring :)
>

Not really.  RcppEigen offers conversion of SEXPs to Eigen::SparseMatrix
and Eigen::MappedSparseMatrix types.  The second uses the storage from R
without copying and hence should generally be declared with the const
modifier.  I think that wonderful vignetter by Bates and Eddelbuettel
describes this :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140203/de27f944/attachment.html>


More information about the Rcpp-devel mailing list