Re: [Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Dirk Eddelbuettel
On 22 June 2013 at 20:34, Marc Jekel wrote: | There was indeed a problem with the matrix index, thank you Dirk! And | using "return Rcpp::wrap(weightsNet)" instead of "return weightsNet" | helped to fix a problem when I created a R-package with the function | included, thank you Simon! You do

Re: [Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Marc Jekel
Dear all, Thank you for the fast and helpful replies! I was able to fix the function/the problem. There was indeed a problem with the matrix index, thank you Dirk! And using "return Rcpp::wrap(weightsNet)" instead of "return weightsNet" helped to fix a problem when I created a R-package wit

Re: [Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Simon Zehnder
I actually do not know, for what you are using this function.are you calling it from R or inside another C++ function? On Jun 22, 2013, at 6:49 PM, Simon Zehnder wrote: > Marc, > > > I tried it via an inline function and I got a segfault. > > it is probably the return value: Rcpp::w

Re: [Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Simon Zehnder
Marc, I tried it via an inline function and I got a segfault. it is probably the return value: Rcpp::wrap(weightsNet) instead of solely weightsNet. Best Simon On Jun 22, 2013, at 6:10 PM, Marc Jekel wrote: > Dear Rcpp users, > > I am a beginner, I was inspired by the new book by E

Re: [Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Dirk Eddelbuettel
Hi Marc, Welcome, and thanks for posting here. >From a quick glance, it looks like for(int loopCol = 0; loopCol < numbCues; loopCol++){ for(int loop = 0; loop < numbCues; loop++) { weightsNet(1+loopCol, numbCues + 1 + loop)= pattern(loopCol,loop); ^

Re: [Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Dale Smith
I would say you should create a simpler example that still crashes. Comment out everything except the first for loop; see if it crashes then. If not, uncomment the next one, etc. Repeat this until you find where it crashes. Do you have a one-off problem with a loop index? I think you do, but wil

[Rcpp-devel] Rcpp matrix generation crashes my R session

2013-06-22 Thread Marc Jekel
Dear Rcpp users, I am a beginner, I was inspired by the new book by Eddelbuettel and just started to use Rccp. So far, everything works fine except for one function. The strange thing about it is that I runs perfectly when I call it several times but crashes my R session at some point (usually