[Rcpp-commits] r2258 - in pkg/Rcpp/inst: include/Rcpp unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 30 12:50:47 CEST 2010


Author: romain
Date: 2010-09-30 12:50:47 +0200 (Thu, 30 Sep 2010)
New Revision: 2258

Modified:
   pkg/Rcpp/inst/include/Rcpp/Extractor.h
   pkg/Rcpp/inst/unitTests/runit.sugar.R
Log:
[windows] workaround, no use of Rcpp::Fast

Modified: pkg/Rcpp/inst/include/Rcpp/Extractor.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Extractor.h	2010-09-30 09:46:53 UTC (rev 2257)
+++ pkg/Rcpp/inst/include/Rcpp/Extractor.h	2010-09-30 10:50:47 UTC (rev 2258)
@@ -29,7 +29,10 @@
     struct Extractor {
         typedef VECTOR type ;  
     } ;  
-    
+
+    // apparently Rcpp::Fast upsets windows, so we stick with 
+    // the identity class above, meaning no fast indexing
+#ifndef WIN32
     template <> 
     struct Extractor<INTSXP, true, Rcpp::Vector<INTSXP> >{
         typedef Rcpp::Fast< Rcpp::Vector<INTSXP> > type ;
@@ -50,8 +53,8 @@
     struct Extractor<RAWSXP, true, Rcpp::Vector<RAWSXP> >{
         typedef Rcpp::Fast< Rcpp::Vector<RAWSXP> > type ;
     } ;
+#endif    
     
-    
 } // traits
 } // Rcpp 
 

Modified: pkg/Rcpp/inst/unitTests/runit.sugar.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.sugar.R	2010-09-30 09:46:53 UTC (rev 2257)
+++ pkg/Rcpp/inst/unitTests/runit.sugar.R	2010-09-30 10:50:47 UTC (rev 2258)
@@ -895,17 +895,17 @@
 }
 
 
-# test.sugar.ifelse <- function( ){
-# 	fx <- .rcpp.sugar$runit_ifelse
-# 	x <- 1:10
-# 	y <- 10:1
-# 	checkEquals( fx( x, y), list( 
-# 		"vec_vec"   = ifelse( x<y, x*x, -(y*y) ) ,
-# 		"vec_prim"  = ifelse( x<y, 1.0, -(y*y) ), 
-# 		"prim_vec"  = ifelse( x<y, x*x, 1.0    ), 
-# 		"prim_prim" = ifelse( x<y, 1.0, 2.0    )
-# 	) )
-# }
+test.sugar.ifelse <- function( ){
+	fx <- .rcpp.sugar$runit_ifelse
+	x <- 1:10
+	y <- 10:1
+	checkEquals( fx( x, y), list( 
+		"vec_vec"   = ifelse( x<y, x*x, -(y*y) ) ,
+		"vec_prim"  = ifelse( x<y, 1.0, -(y*y) ), 
+		"prim_vec"  = ifelse( x<y, x*x, 1.0    ), 
+		"prim_prim" = ifelse( x<y, 1.0, 2.0    )
+	) )
+}
 
 
 test.sugar.isna <- function( ){
@@ -943,26 +943,26 @@
 }
 
 
-# test.sugar.plus <- function( ){
-# 	fx <- .rcpp.sugar$runit_plus
-# 	checkEquals( fx(1:10) , list( 11:20,11:20,1:10+1:10, 3*(1:10))  )
-# }
+test.sugar.plus <- function( ){
+	fx <- .rcpp.sugar$runit_plus
+	checkEquals( fx(1:10) , list( 11:20,11:20,1:10+1:10, 3*(1:10))  )
+}
 
 test.sugar.plus.seqlen <- function( ){
 	fx <- .rcpp.sugar$runit_plus_seqlen
 	checkEquals( fx() , list( 11:20,11:20, 1:10+1:10)  )
-}
+}         
 
-# test.sugar.plus.all <- function( ){
-# 	fx <- .rcpp.sugar$runit_plus_all
-# 	checkEquals( fx(1:10) , FALSE )
-# }
+test.sugar.plus.all <- function( ){
+	fx <- .rcpp.sugar$runit_plus_all
+	checkEquals( fx(1:10) , FALSE )
+} 
 
 test.sugar.pmin <- function( ){
 	fx <- .rcpp.sugar$runit_pmin
 	checkEquals( fx(1:10, 10:1) , c(1:5,5:1) )
 }
-
+                               
 test.sugar.pmin.one <- function( ){
 	fx <- .rcpp.sugar$runit_pmin_one
 	checkEquals( fx(1:10) , 



More information about the Rcpp-commits mailing list