[Rcpp-commits] r2691 - pkg/Rcpp/inst/examples/ConvolveBenchmarks

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 3 08:34:59 CET 2010


Author: romain
Date: 2010-12-03 08:34:58 +0100 (Fri, 03 Dec 2010)
New Revision: 2691

Removed:
   pkg/Rcpp/inst/examples/ConvolveBenchmarks/convolve2_cpp.cpp
Modified:
   pkg/Rcpp/inst/examples/ConvolveBenchmarks/buildAndRun.sh
   pkg/Rcpp/inst/examples/ConvolveBenchmarks/exampleRCode.r
Log:
removing old api example

Modified: pkg/Rcpp/inst/examples/ConvolveBenchmarks/buildAndRun.sh
===================================================================
--- pkg/Rcpp/inst/examples/ConvolveBenchmarks/buildAndRun.sh	2010-12-03 07:30:00 UTC (rev 2690)
+++ pkg/Rcpp/inst/examples/ConvolveBenchmarks/buildAndRun.sh	2010-12-03 07:34:58 UTC (rev 2691)
@@ -10,7 +10,6 @@
 # we have to let R know where the Rcpp header and library are
 export PKG_CPPFLAGS=`Rscript -e "Rcpp:::CxxFlags()"`
 export PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"`
-R CMD SHLIB convolve2_cpp.cpp
 R CMD SHLIB convolve3_cpp.cpp
 R CMD SHLIB convolve4_cpp.cpp
 R CMD SHLIB convolve5_cpp.cpp

Deleted: pkg/Rcpp/inst/examples/ConvolveBenchmarks/convolve2_cpp.cpp
===================================================================
--- pkg/Rcpp/inst/examples/ConvolveBenchmarks/convolve2_cpp.cpp	2010-12-03 07:30:00 UTC (rev 2690)
+++ pkg/Rcpp/inst/examples/ConvolveBenchmarks/convolve2_cpp.cpp	2010-12-03 07:34:58 UTC (rev 2691)
@@ -1,28 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-
-// This is a rewrite of the 'Writing R Extensions' section 5.10.1 example
-
-#include <Rcpp.h>
-
-RcppExport SEXP convolve2cpp(SEXP a, SEXP b)
-{
-    RcppVector<double> xa(a);
-    RcppVector<double> xb(b);
-
-    int nab = xa.size() + xb.size() - 1;
-
-    RcppVector<double> xab(nab);
-    for (int i = 0; i < nab; i++) xab(i) = 0.0;
-
-    for (int i = 0; i < xa.size(); i++)
-	for (int j = 0; j < xb.size(); j++) 
-	    xab(i + j) += xa(i) * xb(j);
-
-    RcppResultSet rs;
-    rs.add("ab", xab);
-    return rs.getReturnList();
-}
-
-#include "loopmacro.h"
-LOOPMACRO_CPP(convolve2cpp)
-

Modified: pkg/Rcpp/inst/examples/ConvolveBenchmarks/exampleRCode.r
===================================================================
--- pkg/Rcpp/inst/examples/ConvolveBenchmarks/exampleRCode.r	2010-12-03 07:30:00 UTC (rev 2690)
+++ pkg/Rcpp/inst/examples/ConvolveBenchmarks/exampleRCode.r	2010-12-03 07:34:58 UTC (rev 2691)
@@ -8,7 +8,6 @@
 
 ## load shared libraries with wrapper code
 dyn.load("convolve2_c.so")
-dyn.load("convolve2_cpp.so")
 dyn.load("convolve3_cpp.so")
 dyn.load("convolve4_cpp.so")
 dyn.load("convolve5_cpp.so")
@@ -25,7 +24,6 @@
 ## and define test functions
 
 R_API_optimised <- function(n,a,b) .Call("convolve2__loop", n, a, b)
-Rcpp_Classic <- function(n,a,b) .Call("convolve2cpp__loop", n, a, b)
 Rcpp_New_std <- function(n,a,b) .Call("convolve3cpp__loop", n, a, b)
 #Rcpp_New_std_inside <- function(n,a,b) .Call("convolve3cpp__loop", n, a, b, PACKAGE = "Rcpp" )
 Rcpp_New_ptr <- function(n,a,b) .Call("convolve4cpp__loop", n, a, b)
@@ -40,14 +38,12 @@
 
 
 v1 <- R_API_optimised(1L, a, b )
-v2 <- Rcpp_Classic(1L,a,b)[[1]]
 v3 <- Rcpp_New_std(1L, a, b)
 v4 <- Rcpp_New_ptr(1L, a, b)
 v5 <- Rcpp_New_sugar(1L, a, b )
 v7 <- R_API_naive(1L, a, b)
 v11 <- Rcpp_New_sugar_noNA(1L, a, b)
 
-stopifnot(all.equal(v1, v2))
 stopifnot(all.equal(v1, v3))
 stopifnot(all.equal(v1, v4))
 stopifnot(all.equal(v1, v5))
@@ -59,7 +55,6 @@
 REPS <- 5000L
 bm <- benchmark(R_API_optimised(REPS,a,b),
                 R_API_naive(REPS,a,b),
-                Rcpp_Classic(REPS,a,b),
                 Rcpp_New_std(REPS,a,b),
 #                Rcpp_New_std_inside(REPS,a,b),
                 Rcpp_New_ptr(REPS,a,b),
@@ -86,7 +81,6 @@
     a <- rnorm(size); b <- rnorm(size)
     bm <- benchmark(R_API_optimised(REPS,a,b),
                 R_API_naive(REPS,a,b),
-                Rcpp_Classic(REPS,a,b),
                 Rcpp_New_std(REPS,a,b),
                 Rcpp_New_ptr(REPS,a,b),
                 Rcpp_New_sugar(REPS,a,b),



More information about the Rcpp-commits mailing list