[Rcpp-commits] r1243 - scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 14 14:09:57 CEST 2010


Author: edd
Date: 2010-05-14 14:09:57 +0200 (Fri, 14 May 2010)
New Revision: 1243

Added:
   scripts/checkFastLm.r
Log:
helper script


Added: scripts/checkFastLm.r
===================================================================
--- scripts/checkFastLm.r	                        (rev 0)
+++ scripts/checkFastLm.r	2010-05-14 12:09:57 UTC (rev 1243)
@@ -0,0 +1,43 @@
+#!/usr/bin/r
+library(datasets)
+
+data(trees)
+
+firstTest <- function() {
+    f1 <- lm(log(Girth) ~ log(Volume), data=trees)
+    print(f1)
+    print(summary(f1))
+
+    suppressMessages(library(RcppGSL))
+    f2 <- fastLm(log(Girth) ~ log(Volume), data=trees)
+    print(f2)
+    print(summary(f2))
+
+    suppressMessages(library(RcppArmadillo))
+    f3 <- fastLm(log(Girth) ~ log(Volume), data=trees)
+    print(f3)
+    print(summary(f3))
+}
+
+secondTest <- function() {
+    y <- log(trees$Girth)
+    X <- cbind(1, log(trees$Volume))
+    colnames(X) <- c("iota", "logVol")
+
+    f1 <- lm.fit(X, y)
+    print(f1)
+    #print(summary(f1))
+
+    suppressMessages(library(RcppGSL))
+    f2 <- fastLm(X, y)
+    print(f2)
+    print(summary(f2))
+
+    suppressMessages(library(RcppArmadillo))
+    f3 <- fastLm(X, y)
+    print(f3)
+    print(summary(f3))
+}
+
+firstTest()
+secondTest()


Property changes on: scripts/checkFastLm.r
___________________________________________________________________
Added: svn:executable
   + *



More information about the Rcpp-commits mailing list