[Rcpp-devel] RcppEigen: Getting and setting dimnames of sparse matrix

Søren Højsgaard sorenh at math.aau.dk
Fri Jan 25 12:32:20 CET 2013


Thanks Doug,

I made an example illustrating this for the Rcpp gallery - AND I forgot to acknowledge you in the example. That was a mistake - sorry!

Regards
Søren

From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas Bates
Sent: 19. januar 2013 16:58
To: Dirk Eddelbuettel
Cc: Søren Højsgaard; rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] RcppEigen: Getting and setting dimnames of sparse matrix


On Sat, Jan 19, 2013 at 10:38 AM, Douglas Bates <bates at stat.wisc.edu<mailto:bates at stat.wisc.edu>> wrote:

On thinking about this a bit more, the dimnames should be cloned before being assigned, otherwise you end up with two references to the same storage.  And once you try to clone you get into the SlotProxy area where you need to know what you are cloning.  One way of doing this is shown in the enclosed.  An alternative is

Xout.slot("Dimnames") = clone(as<SEXP>((Xin.slot("Dimnames"))));

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130125/75879cdb/attachment.html>


More information about the Rcpp-devel mailing list