3 suppressMessages(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.
9 suppressMessages(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++)
23 funx_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.
28 cppFunction('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++)
40 dd.inline.rcpp <- function() {
45 print(mean(replicate(100,system.time(dd.inline.rcpp())["elapsed"]),trim=0.05))