[Rcpp-commits] r3224 - pkg/RcppEigen/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 26 17:19:56 CEST 2011


Author: dmbates
Date: 2011-10-26 17:19:56 +0200 (Wed, 26 Oct 2011)
New Revision: 3224

Modified:
   pkg/RcppEigen/src/RcppEigen.cpp
Log:
Add externally callable functions for Eigen version and SSE instruction sets in use.


Modified: pkg/RcppEigen/src/RcppEigen.cpp
===================================================================
--- pkg/RcppEigen/src/RcppEigen.cpp	2011-10-26 15:18:53 UTC (rev 3223)
+++ pkg/RcppEigen/src/RcppEigen.cpp	2011-10-26 15:19:56 UTC (rev 3224)
@@ -21,21 +21,32 @@
 
 #include <RcppEigen.h>
 
-extern "C" SEXP eigen_version(SEXP single_){
-    using Rcpp::_;
-    using Rcpp::IntegerVector;
-    using Rcpp::wrap;
+extern "C" {
+    SEXP eigen_version(SEXP single_){
+	using Rcpp::_;
+	using Rcpp::IntegerVector;
+	
+	BEGIN_RCPP;
+	bool single = Rcpp::as<bool>(single_) ;
+	if( single ){
+	    return Rcpp::wrap( 10000 * EIGEN_WORLD_VERSION +
+			       100 * EIGEN_MAJOR_VERSION + 
+			       EIGEN_MINOR_VERSION ) ;
+	}
+	
+	return IntegerVector::create(_["major"] = EIGEN_WORLD_VERSION,
+				     _["minor"] = EIGEN_MAJOR_VERSION,
+				     _["patch"] = EIGEN_MINOR_VERSION);
+	END_RCPP;
+    }
 
-    bool single = Rcpp::as<bool>(single_) ;
-    if( single ){
-	return wrap( 10000 * EIGEN_WORLD_VERSION +
-		     100 * EIGEN_MAJOR_VERSION + 
-		     EIGEN_MINOR_VERSION ) ;
+    SEXP Eigen_SSE() {
+	BEGIN_RCPP;
+	return Rcpp::wrap(Eigen::SimdInstructionSetsInUse());
+	END_RCPP;
     }
-
-    return IntegerVector::create(_["major"] = EIGEN_WORLD_VERSION,
-				 _["minor"] = EIGEN_MAJOR_VERSION,
-				 _["patch"] = EIGEN_MINOR_VERSION);
 }
 
 
+
+



More information about the Rcpp-commits mailing list