[Rcpp-devel] Rcpp matrix generation crashes my R session
Dirk Eddelbuettel
edd at debian.org
Sat Jun 22 18:48:45 CEST 2013
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);
^^^^^^^^^^^^^^^^^^^
}
}
is to blame. loop runs from 0 .. numbCues-1, you add numbCues plus one and
are possibly getting more than numbCues+3:
NumericMatrix weightsNet(numbCues+3,numbCues+3);
Hope this helps, Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list