[Rcpp-devel] [ANN] RcppArmadillo 0.4.650.1.1 (and even 0.4.650.2.0)

2015-02-26 Thread Dirk Eddelbuettel
New RcppArmadillo relase(s) -- I just posted the following (with proper links and highlighting) to http://dirk.eddelbuettel.com/blog/2015/02/26#rcpparmadillo_0.4.650.1.1 In short, a new RcppArmadillo is on CRAN, and an even newer is available via a drat repo. See other recent posts on my blo

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Nathan Kurz
On Thu, Feb 26, 2015 at 12:28 PM, Matt D. wrote: > On 2/26/2015 18:59, Dirk Eddelbuettel wrote: >> >> On 26 February 2015 at 18:35, Matt D. wrote: >> | Which incidentally brings me to the advice I usually give in these >> situations: >> | unless you're absolutely dependent on the "features" of >>

Re: [Rcpp-devel] Rcpp-devel Digest, Vol 64, Issue 16

2015-02-26 Thread Christian Gunning
I thought I'd step in and grab this one :) "In general, it's certainly a reasonable point that there is a trade-off to be made -- user-friendliness against the potential extra copies (not sure whether this has ever been measured -- as in counting the cases of `clone`-less existing code-bases where

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Matt D.
On 2/26/2015 18:59, Dirk Eddelbuettel wrote: On 26 February 2015 at 18:35, Matt D. wrote: | Which incidentally brings me to the advice I usually give in these situations: | unless you're absolutely dependent on the "features" of `Rcpp::NumericVector` | just forget about it and replace all uses wi

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Dirk Eddelbuettel
On 26 February 2015 at 18:35, Matt D. wrote: | Which incidentally brings me to the advice I usually give in these situations: | unless you're absolutely dependent on the "features" of `Rcpp::NumericVector` | just forget about it and replace all uses with the standard container | `std::vector`. No

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Matt D.
On 2/26/2015 16:37, Pierre GLOAGUEN wrote: Thanks, it works! I'm not familiar with C++, is it necessary to always use such a function in C++ or is it because of R/C++ interface? Hi Pierre! You're witnessing yet another fascinating difference between (usual in the world of C++) value semantics

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Pierre GLOAGUEN
Ok, i'll do this. Thanks and have a nice day, Pierre Le 26/02/2015 16:51, Dirk Eddelbuettel a écrit : On 26 February 2015 at 16:37, Pierre GLOAGUEN wrote: | Thanks, it works! | I'm not familiar with C++, is it necessary to always use such a function in C++ | or is it because of R/C++ interface

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Dirk Eddelbuettel
On 26 February 2015 at 16:37, Pierre GLOAGUEN wrote: | Thanks, it works! | I'm not familiar with C++, is it necessary to always use such a function in C++ | or is it because of R/C++ interface? Please use a Google search (or equivalent) for Rcpp::clone. This has been discussed extensively on nu

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Pierre GLOAGUEN
Thanks, it works! I'm not familiar with C++, is it necessary to always use such a function in C++ or is it because of R/C++ interface? Thanks again for your help, Pierre Le 26/02/2015 16:30, Jeffrey Pollock a écrit : Perhaps use the clone() function? library(Rcpp) cppFunction(" NumericVecto

Re: [Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Jeffrey Pollock
Perhaps use the clone() function? library(Rcpp) cppFunction(" NumericVector par_CMAtR(NumericVector vec_CMA) { NumericVector out = clone(vec_CMA); out[5] = exp(out[5]); return out; } ") vec_C <- rep(1, 6) par_CMAtR(vec_C) print(vec_C) On Thu, Feb 26, 2015 at 3:16 PM, Pierre GLOAGUEN

[Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Pierre GLOAGUEN
Hello everybody, I have a very simple example I have a vector vec_CMA which length is a multiple of 6. I want to get the exact same vector, except the last element which is the exponential of the last element of vec_CMA The code is the following //myfun.cpp #include using namespace Rcpp; //