[Rcpp-commits] r2175 - pkg/RcppArmadillo/inst/include

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 25 19:11:03 CEST 2010


Author: romain
Date: 2010-09-25 19:11:03 +0200 (Sat, 25 Sep 2010)
New Revision: 2175

Modified:
   pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h
Log:
gotcha

Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h
===================================================================
--- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h	2010-09-25 16:54:35 UTC (rev 2174)
+++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h	2010-09-25 17:11:03 UTC (rev 2175)
@@ -120,15 +120,14 @@
     	
     	template <typename T1, typename eop_type>
     	SEXP wrap_eop( const arma::eOp<T1,eop_type>& X, ::Rcpp::traits::false_type ){
-            // int n_rows = X.P.get_n_rows();
-            // int n_cols = X.P.get_n_cols();
-            // typedef typename ::Rcpp::Vector< ::Rcpp::traits::r_sexptype_traits< typename T1::elem_type>::rtype > VECTOR ;
-            // VECTOR res(::Rcpp::Dimension( n_rows , n_cols )) ;
-            // ::arma::Mat<typename T1::elem_type> result( res.begin(), n_rows, n_cols) ; // , false ) ;
-            // result = X ;
-            // return res ;
-            return ::Rcpp::wrap( arma::Mat<typename T1::elem_type>(X) ) ;
-    	}
+            int n_rows = X.get_n_rows();
+            int n_cols = X.get_n_cols();
+            typedef typename ::Rcpp::Vector< ::Rcpp::traits::r_sexptype_traits< typename T1::elem_type>::rtype > VECTOR ;
+            VECTOR res(::Rcpp::Dimension( n_rows , n_cols )) ;
+            ::arma::Mat<typename T1::elem_type> result( res.begin(), n_rows, n_cols, false ) ;
+            result = X ;
+            return res ;
+        }
     	
     	template <typename T1, typename eop_type>
     	SEXP wrap_eop( const arma::eOp<T1,eop_type>& X, ::Rcpp::traits::true_type ){



More information about the Rcpp-commits mailing list