[Rcpp-devel] Sparse matrix operations

Yixuan Qiu yixuan.qiu at cos.name
Tue Feb 4 17:09:10 CET 2014


Sure. What are you planning to do with ARPACK? It seems that the newest
version of Armadillo already supports eigs_sym() and eigs_gen() to retrieve
a limited number of eigenvalues.


Best,
Yixuan


2014-02-03 Dirk Eddelbuettel <edd at debian.org>:

>
> On 3 February 2014 at 18:09, Yixuan Qiu wrote:
> | A pretty nice feature of Eigen is that it allows you to map an existing
> memory
> | address to an Eigen object, so the data stored in R can be directly
> reused by
> | Eigen. This may be the key point if we want to avoid copying data from R
> to
> | Eigen/Armadillo. Dirk, does Armadillo has such kind of constructor to
> receive a
> | pointer as input to initialize a vector or matrix?
>
> Yes, and we've been using it for years. And documented it as such.  For
> details, see Conrad's docs, eg http://arma.sourceforge.net/docs.html#Matand
> look at 'Advanced Constructors'.
>
> | Currently RcppEigen supports direct conversion from dgCMatrix, the
> | column-oriented sparse matrix class in the Matrix package. After you
> finish the
> | conversion, you can make use of all the fancy stuffs on sparse matrices
> | provided by Eigen, including basic arithmetic operations, linear algebra
> | solvers and matrix factorizations. It really helped me a lot when
> developing
> | rARPACK. Thank you Doug and Dirk. :-)
>
> Thank you for rARPACK!
>
> I'll need to talk to you once Conrad exposes more code and we need eigs
> etc.
> We can possibly deploy that in RcppArmadillo.  Maybe we'll need to factor
> out
> the basic ARPACK parts to be used by rARPACK and us.  Or some other scheme.
> Suggestions welcome :)
>
> Cheers, Dirk
>
>
> | Best,
> | Yixuan
> |
> |
> |
> | 2014-02-03 Dirk Eddelbuettel <edd at debian.org>:
> |
> |
> |     On 3 February 2014 at 12:59, Douglas Bates wrote:
> |     | 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.
> |
> |     Oooops. My bad.
> |
> |     I guess I generalized from my less performing converters contributed
> to
> |     RcppArmadillo. Time permitting, maybe I should have another look at
> |     RcppEigen
> |     and see if I can do better for RcppArmadillo.
> |
> |     | I think that wonderful vignetter by Bates and Eddelbuettel
> describes this
> |     :-)
> |
> |     :-)
> |
> |     Dirk
> |
> |     --
> |     Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> |     _______________________________________________
> |     Rcpp-devel mailing list
> |     Rcpp-devel at lists.r-forge.r-project.org
> |
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> |
> |
> |
> |
> | --
> | Yixuan Qiu <yixuan.qiu at cos.name>
> | Department of Statistics,
> | Purdue University
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>



-- 
Yixuan Qiu <yixuan.qiu at cos.name>
Department of Statistics,
Purdue University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140204/19b7cdc9/attachment.html>


More information about the Rcpp-devel mailing list