[Rcpp-commits] r441 - pkg/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 24 13:00:33 CET 2010


Author: romain
Date: 2010-01-24 13:00:31 +0100 (Sun, 24 Jan 2010)
New Revision: 441

Modified:
   pkg/inst/unitTests/runit.NumericVector.R
Log:
checking matrix indexing on the lhs

Modified: pkg/inst/unitTests/runit.NumericVector.R
===================================================================
--- pkg/inst/unitTests/runit.NumericVector.R	2010-01-24 11:41:29 UTC (rev 440)
+++ pkg/inst/unitTests/runit.NumericVector.R	2010-01-24 12:00:31 UTC (rev 441)
@@ -68,5 +68,15 @@
 	y <- as.vector( x )
 	checkException( funx(y) , msg = "not a matrix" )
 	
+	funx <- cfunction(signature(x = "numeric" ), '
+		NumericVector m(x) ;
+		double trace = 0.0 ;
+		for( size_t i=0 ; i<4; i++){
+			m(i,i) = 2.0 * i ;
+		}
+		return m ;
+	', Rcpp = TRUE, includes = "using namespace Rcpp;"  )
+	checkEquals( diag(funx(x)), 2.0*0:3, msg = "matrix indexing lhs" )
+	
 }
 



More information about the Rcpp-commits mailing list