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 beca

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

2015-02-26 Thread Pierre GLOAGUEN
ction(" 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 mailto:pierre.gloag...@ifremer.fr>> wrote:

[Rcpp-devel] function modifying it self its argument

2015-02-26 Thread Pierre GLOAGUEN
) [1] 1 1 1 1 1 2.718282 8 works fine. Except the vec_C is modified too! vec_C [1] 1 1 1 1 1 2.718282 It's the first time I have this kind of problem. What is wrong in my code? Thanks for your help, Pierre Gloaguen ___ Rcpp-devel mailing list

Re: [Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-08 Thread Pierre . Gloaguen
ws), even if, so far, I'm learning how to use it. Just one last thing, congratulations for your package, the improvement in computation time is amazing (not far than 1000 times faster in my case)! Thanks again, Pierre Gloaguen Jonathan Olmsted a écrit : So, you think I should go to

Re: [Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-07 Thread Pierre . Gloaguen
Hello Jonathan, Thanks a lot for your help. I didn't know valgrind, but i'll definitely go into it. Thanks very much for your help. So, you think I should go to postfix increments instead of prefix? I'm a beginner in C++, so I'm not comfortable on which of them to chose. You seem to be righ

Re: [Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-07 Thread Pierre . Gloaguen
Hello Dirk, I will do what I can to reduce the code and have to same error occuring. Of course i don't expect you to read all of it :) I was just wondering if that kind of memory problem occured before, and if has some "typical/generic" solutions. I will try to have a shortest code to exhibi

Re: [Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-07 Thread Pierre . Gloaguen
before in R, it was slower but it never failed for memory reasons. I run on R 3.1.1, platform x86_64-w64-mingw32/x64 (64-bit) I work on windows 7. I attach the cpp_functions, the R_programm that embeds the last function, and a R file debug_test wich gives R code to test the functions and lead

Re: [Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-06 Thread Pierre . Gloaguen
your code in any detail. No worries! I'm glad I found out by myself after all this times Have a nice day, Pierre Dirk | like this | NumericVector myfunction(NumericVector x){ | for(int= i = 0; i < x.size; ++i){ | //do my stuff; | gc(); | } | } | | Thanks for any help! | | Pierre

Re: [Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-06 Thread Pierre . Gloaguen
eads me to another question. Is there anyway to force the garbage collection inside a Rcpp function? like this NumericVector myfunction(NumericVector x){ for(int= i = 0; i < x.size; ++i){ //do my stuff; gc(); } } Thanks for any help! Pierre Gloaguen pgloa...@ifremer.fr a écrit : Hello ev

[Rcpp-devel] R session crashes when largely using a Rcpp sourced function

2014-10-03 Thread Pierre . Gloaguen
rs for all intermediate functions. Sorry for the length of the function, I'm pretty sure the problem comes from the main function, but it sadly depends on others (which, as far as I know, don't pose problems) Thanks in advance for any help, Pierre Gloaguen library(R