[Rcpp-commits] r946 - pkg/Rcpp/inst/examples/FastLM

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 26 16:40:20 CET 2010


Author: edd
Date: 2010-03-26 16:40:20 +0100 (Fri, 26 Mar 2010)
New Revision: 946

Modified:
   pkg/Rcpp/inst/examples/FastLM/benchmark.r
   pkg/Rcpp/inst/examples/FastLM/lmArmadillo.R
   pkg/Rcpp/inst/examples/FastLM/lmGSL.R
Log:
use new create() wrapper for returned object
restore GSL example in benchmark.r wrapper


Modified: pkg/Rcpp/inst/examples/FastLM/benchmark.r
===================================================================
--- pkg/Rcpp/inst/examples/FastLM/benchmark.r	2010-03-26 13:31:42 UTC (rev 945)
+++ pkg/Rcpp/inst/examples/FastLM/benchmark.r	2010-03-26 15:40:20 UTC (rev 946)
@@ -23,7 +23,7 @@
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
 source("lmArmadillo.R")
-# source("lmGSL.R")
+source("lmGSL.R")
 
 set.seed(42)
 n <- 25000
@@ -34,16 +34,16 @@
 
 N <- 100
 
-# lmgsl <- lmGSL()
+lmgsl <- lmGSL()
 lmarma <- lmArmadillo()
 
 tlm <- mean(replicate(N, system.time( lmfit <- lm(y ~ X - 1) )["elapsed"]), trim=0.05)
 tlmfit <- mean(replicate(N, system.time(lmfitfit <- lm.fit(X, y))["elapsed"]), trim=0.05)
-# tlmgsl <- mean(replicate(N, system.time(lmgsl(y, X))["elapsed"]), trim=0.05)
+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, 
+res <- c(tlm, tlmfit,
+	tlmgsl,
 	tlmarma)
 data <- t(data.frame(results=res, ratios=tlm/res))
 cat("For n=", n, " and k=", k, "\n", sep="")

Modified: pkg/Rcpp/inst/examples/FastLM/lmArmadillo.R
===================================================================
--- pkg/Rcpp/inst/examples/FastLM/lmArmadillo.R	2010-03-26 13:31:42 UTC (rev 945)
+++ pkg/Rcpp/inst/examples/FastLM/lmArmadillo.R	2010-03-26 15:40:20 UTC (rev 946)
@@ -44,9 +44,8 @@
         stderrestr[i] = sqrt(covmat(i,i));
     }
 
-    Rcpp::Pairlist res(Rcpp::Named( "coefficients", coefr),
-                       Rcpp::Named( "stderr", stderrestr));
-    return res;
+    return Rcpp::List::create( Rcpp::Named( "coefficients", coefr),
+                               Rcpp::Named( "stderr", stderrestr));
     '
 
     ## turn into a function that R can call

Modified: pkg/Rcpp/inst/examples/FastLM/lmGSL.R
===================================================================
--- pkg/Rcpp/inst/examples/FastLM/lmGSL.R	2010-03-26 13:31:42 UTC (rev 945)
+++ pkg/Rcpp/inst/examples/FastLM/lmGSL.R	2010-03-26 15:40:20 UTC (rev 946)
@@ -55,8 +55,9 @@
     gsl_vector_free (c);
     gsl_matrix_free (cov);
 
-    Rcpp::Pairlist res(Rcpp::Named( "coef", coefr), Rcpp::Named( "stderr", stderrestr));
-    return res;
+
+    return Rcpp::List::create( Rcpp::Named( "coef", coefr),
+                               Rcpp::Named( "stderr", stderrestr));
     '
 
     ## turn into a function that R can call



More information about the Rcpp-commits mailing list