[Rcpp-commits] r1772 - pkg/Rcpp/inst/examples/FastLM
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 4 05:04:51 CEST 2010
Author: edd
Date: 2010-07-04 05:04:48 +0200 (Sun, 04 Jul 2010)
New Revision: 1772
Modified:
pkg/Rcpp/inst/examples/FastLM/benchmark.r
Log:
slightly wider regression matrix, more nicely formatted results
Modified: pkg/Rcpp/inst/examples/FastLM/benchmark.r
===================================================================
--- pkg/Rcpp/inst/examples/FastLM/benchmark.r 2010-07-04 01:01:47 UTC (rev 1771)
+++ pkg/Rcpp/inst/examples/FastLM/benchmark.r 2010-07-04 03:04:48 UTC (rev 1772)
@@ -27,7 +27,7 @@
set.seed(42)
n <- 25000
-k <- 1
+k <- 9
X <- cbind( rep(1,n), matrix(rnorm(n*k), ncol=k) )
truecoef <- 1:(k+1)
y <- as.numeric(X %*% truecoef + rnorm(n))
@@ -42,10 +42,10 @@
tlmgsl <- mean(replicate(N, system.time(lmgsl(y, X))["elapsed"]), trim=0.05)
tlmarma <- mean(replicate(N, system.time(lmarma(y, X))["elapsed"]), trim=0.05)
-res <- c(tlm, tlmfit,
- tlmgsl,
- tlmarma)
-data <- t(data.frame(results=res, ratios=tlm/res))
+res <- c(tlm, tlmfit, tlmgsl, tlmarma)
+data <- data.frame(results=res, ratios=tlm/res)
+rownames(data) <- c("lm", "lm.fit", "lmGSL", "lmArma")
cat("For n=", n, " and k=", k, "\n", sep="")
-print(data)
+print(t(data))
+print(t(1/data[,1,drop=FALSE])) # regressions per second
More information about the Rcpp-commits
mailing list