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

Søren Højsgaard sorenh at math.aau.dk
Sat Jan 19 23:13:22 CET 2013


Dear Dirk and Doug,

Thanks for your help. As I understand it, Dougs solution is to first wrap the result and then deal with attributes afterwards. An example in the gallery would perhaps be welcome?

Thanks again
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/20130119/eef58906/attachment.html>


More information about the Rcpp-devel mailing list