[Rinside-commits] r123 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 17 14:39:37 CET 2010


Author: edd
Date: 2010-03-17 14:39:37 +0100 (Wed, 17 Mar 2010)
New Revision: 123

Modified:
   pkg/src/RInside.cpp
Log:
remove matrix-fudge glue we no longer need for examples and hence no longer need to expose


Modified: pkg/src/RInside.cpp
===================================================================
--- pkg/src/RInside.cpp	2010-03-17 13:36:56 UTC (rev 122)
+++ pkg/src/RInside.cpp	2010-03-17 13:39:37 UTC (rev 123)
@@ -304,40 +304,3 @@
     return global_env[name]; 
 }
 
-// specializations of Rcpp wrap template
-// this overwrites the default behaviour in Rcpp that would 
-// wrap vector<vector<double>> as lists of numeric vectors
-//
-// RInside uses vector<vector<double>> as matrices
-
-namespace Rcpp{
-
-    template<> SEXP wrap(const std::vector< std::vector< double > > & v) {
-	int nx = v.size();
-	int ny = v[0].size();
-	SEXP sexpmat = PROTECT(Rf_allocMatrix(REALSXP, nx, ny));
-	double* p = REAL(sexpmat) ;
-	for(int i = 0; i < nx; i++) {
-	    for(int j = 0; j < ny; j++) {
-		p[i + nx*j] = v[i][j];
-	    }
-	}
-	UNPROTECT(1);
-	return sexpmat ;
-    }
-
-    template<> SEXP wrap(const std::vector< std::vector< int > > & v) {
-	int nx = v.size();
-	int ny = v[0].size();
-	SEXP sexpmat = PROTECT(Rf_allocMatrix(INTSXP, nx, ny));
-	int *p = INTEGER(sexpmat) ; /* do this just once */
-	for(int i = 0; i < nx; i++) {
-	    for(int j = 0; j < ny; j++) {
-		p[i + nx*j] = v[i][j];
-	    }
-	}
-	UNPROTECT(1);
-	return sexpmat ;
-    }
-
-}



More information about the Rinside-commits mailing list