Displaying 1 result from an estimated 1 matches for "check_abort".
2012 Feb 23
0
RcppProgress: progress monitoring and interrupting c++ code, request for comments
...{ // the only way to exit an OpenMP loop
long_computation(nb);
p.increment(); // update the progress
}
}
and in your computation intensive function:
void long_computation(int nb) {
double sum = 0;
for (int i = 0; i < nb; ++i) {
if ( Progress::check_abort() )
return;
for (int j = 0; j < nb; ++j) {
sum += Rf_dlnorm(i+j, 0.0, 1.0, 0);
}
}
}
I provided two small R test functions so that you can see how it looks,
please see the doc.
I would be extremely grateful if you could give me comments, criticisms...