R/Rcpp/C++ for speed.