Skip to content
Prev 9467 / 10988 Next

[Rcpp-devel] Rcpp ISNAN slower than C ISNAN?

Or better yet, just use the original code with NumericMatrix:
sData1[i * numVars + k] does the right thing.
I don't get any timing difference based on this change.

Using Rcpp sugar
(https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-sugar.pdf),
and moving the call outside the loop, appears to do the right thing.

## modified example
## see edits here:
https://github.com/helmingstay/rcpp-timings/blob/master/diff/rcppdist.cpp#L24
git clone https://github.com/helmingstay/rcpp-timings
cd rcpp-timings/diff
R --vanilla < glue.R

best,
Christian