[Rcpp-commits] r3111 - pkg/RcppEigen/inst/include

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 29 16:40:35 CEST 2011


Author: dmbates
Date: 2011-06-29 16:40:35 +0200 (Wed, 29 Jun 2011)
New Revision: 3111

Modified:
   pkg/RcppEigen/inst/include/RcppEigenWrap.h
Log:
Syntax errors corrected.


Modified: pkg/RcppEigen/inst/include/RcppEigenWrap.h
===================================================================
--- pkg/RcppEigen/inst/include/RcppEigenWrap.h	2011-06-29 12:59:45 UTC (rev 3110)
+++ pkg/RcppEigen/inst/include/RcppEigenWrap.h	2011-06-29 14:40:35 UTC (rev 3111)
@@ -64,15 +64,19 @@
 
 	template <typename T>
     SEXP wrap(const Eigen::SparseMatrix<T>& object ) {
-		int       nnz = object.nonZeros(), p = object.outerSize();
-		const int *ip = object._innerIndexPtr(), *pp = object._outerIndexPtr();
-		const T   *xp = object._valuePtr();
+		int          nnz = object.nonZeros(), p = object.outerSize();
+		Dimension    dim(object.innerSize(), p);
+		const int    *ip = object._innerIndexPtr(), *pp = object._outerIndexPtr();
+		const T      *xp = object._valuePtr();
+		IntegerVector iv(ip, ip + nnz), pv(pp, pp + p + 1);
+		NumericVector xv(xp, xp + nnz);
 		
-		return List(_["Dim"] = Dimension(object.rows(), p),
-					_["i"]   = ::Rcpp::wrap(ip, ip + nnz),
-					_["p"]   = ::Rcpp::wrap(pp, pp + p + 1),
-					_["x"]   = ::Rcpp::wrap(xp, xp + nnz));
+		return ::Rcpp::wrap(List::create(_["Dim"] = dim,
+										 _["i"]   = iv,
+										 _["p"]   = pv,
+										 _["x"]   = xv));
 	}
+
 #if 0
     /* support for Rcpp::as */
 	



More information about the Rcpp-commits mailing list