3suppressMessages(library(Rcpp))
5## NOTE: This is the old way to compile Rcpp code inline.
6## The code here has left as a historical artifact and tribute to the old way.
7## Please use the code under the "new" inline compilation section.
9suppressMessages(library(inline))
12 IntegerVector vec(10000); // vec parameter viewed as vector of ints.
14 for (int a = 0; a < 9; a++)
15 for (int b = 0; b < 9; b++)
16 for (int c = 0; c < 9; c++)
17 for (int d = 0; d < 9; d++)
23funx_old <- cxxfunction(signature(), foo, plugin = "Rcpp" )
25## NOTE: Within this section, the new way to compile Rcpp code inline has been
26## written. Please use the code next as a template for your own project.
28cppFunction('IntegerVector funx(){
29 IntegerVector vec(10000); // vec parameter viewed as vector of ints.
31 for (int a = 0; a < 9; a++)
32 for (int b = 0; b < 9; b++)
33 for (int c = 0; c < 9; c++)
34 for (int d = 0; d < 9; d++)
40dd.inline.rcpp <- function() {
45print(mean(replicate(100,system.time(dd.inline.rcpp())["elapsed"]),trim=0.05))