On May 2, 2013 11:22 PM, "Dirk Eddelbuettel" <[email protected]> wrote: > > > On 2 May 2013 at 17:24, Dirk Eddelbuettel wrote: > | Sorry. It was just a quick guess. > | > | On second thought, I think your earlier approach was actually pretty good: > | Take your arma object, use wrap to turn it into a SEXP (or maybe an RObject) > | and you should then be able to set attributes. > > And on third thought, I think we both overlooked one aspect: > > -- R and Rcpp can share objects, passing them back and forth efficiently via > pointers as _both use the same allocation scheme_. So when Rcpp creates > an object, it is "as if" R created it. Which is why we can generally > move them back and forth. > > -- That does not hold for Armadillo. So to bring an Armadillo object back, > we are better off making a copy.
Depending on the context, you could pre-create both matrices in R and pass them in to Rcpp/Armadillo as Dirk suggests. Manipulate them as necessary and they are available back in R when you are done. Krzysztof > > So once again the "No Free Lunch" theorem at work. Sorry. > > Dirk > > -- > Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com > _______________________________________________ > Rcpp-devel mailing list > [email protected] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
_______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
