[Rcpp-devel] Fwd: Stack Overflow Question
Darren Cook
darren at dcook.org
Thu Oct 11 01:35:06 CEST 2012
> Garret said that its too "localized", in his post of SO, what he means
> with this? It can be a problem of my code or it has to be a problem with the system I'm
> running the program?
It could be your system, or it could be a bug in your code that only
affects your system. It could be the Rcpp compiler flags are different
for the people for whom it works. It could be different installed
packages (in that case that could mean different versions of Rcpp,
inline or RcppArmadillo).
With so many possible causes, and such a long test script, people won't
want to help :-)
You need to systematically try to shrink call.gibbs, until you stop
triggering the error. Then build it up until you trigger it again.
Repeat until you've narrowed it down to one line.
I'd start with:
* Pull out the entire for(k=0;k<Na;k++) loop, i.e. the second half of
your function.
If that works (i.e. it no longer crashes), a hunch would tell me to
target the std::transform calls, but instead I'd carry on being
systematic, so:
* Put back the for(k...) loop, then strip out everything from the
"continuing control" comment down to the "class_table(l2,k) = pos;" line.
That is chosen because it is about halfway down :-)
Of course, dumb divide-and-conquer will trip up on variables not being
defined. So each time add the minimum you need to get it to compile.
Darren
>> | rcpp caught segfault
>> | http://stackoverflow.com/q/10123751/1265067?sem=2
More information about the Rcpp-devel
mailing list