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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 13 02:59:11 CET 2010


Author: edd
Date: 2010-01-13 02:59:11 +0100 (Wed, 13 Jan 2010)
New Revision: 362

Modified:
   pkg/inst/examples/ConvolveBenchmarks/exampleRCode.r
Log:
remove unused vars, pretty-print result and use all.equal rather than identical

Modified: pkg/inst/examples/ConvolveBenchmarks/exampleRCode.r
===================================================================
--- pkg/inst/examples/ConvolveBenchmarks/exampleRCode.r	2010-01-13 01:58:45 UTC (rev 361)
+++ pkg/inst/examples/ConvolveBenchmarks/exampleRCode.r	2010-01-13 01:59:11 UTC (rev 362)
@@ -44,21 +44,17 @@
 t7 <- system.time(replicate(1000, .Call("convolve7", a, b)))
 
 
+res <- data.frame(rbind(t1, t7, t2, t3, t4))
+rownames(res) <- c("Writing R extensions",
+                   "Less careful use of R API",
+                   "RcppVector<double>::operator()",
+                   "Rcpp::NumericVector::operator[]",
+                   "Rcpp::NumericVector::begin()")
+print(res)
 
-cat( "Writing R extensions:\n" )
-print(t1)
-cat( "\nLess careful use of R API\n")
-print(t7)
-cat( "\nRcppVector<double>::operator()\n")
-print(t2)
-cat( "\nRcpp::NumericVector::operator[]\n")
-print(t3)
-cat( "\nRcpp::NumericVector::begin()\n")
-print(t4)
-
 results <- list( v1, v2, v3, v4, v7)
-for( i in seq_along(results) ){
-	stopifnot( identical(results[[1L]], results[[i]] ) )
+for (i in seq_along(results) ){
+    stopifnot( all.equal(results[[1L]], results[[i]] ) )
 }
+cat("All results are equal\n") # as we didn't get stopped
 
-



More information about the Rcpp-commits mailing list