[Rcpp-commits] r3135 - pkg/RcppEigen/inst/include
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jul 13 12:13:44 CEST 2011
Author: romain
Date: 2011-07-13 12:13:43 +0200 (Wed, 13 Jul 2011)
New Revision: 3135
Modified:
pkg/RcppEigen/inst/include/RcppEigenWrap.h
Log:
deal with dimensions in eigen_wrap_is_plain
Modified: pkg/RcppEigen/inst/include/RcppEigenWrap.h
===================================================================
--- pkg/RcppEigen/inst/include/RcppEigenWrap.h 2011-07-13 09:59:38 UTC (rev 3134)
+++ pkg/RcppEigen/inst/include/RcppEigenWrap.h 2011-07-13 10:13:43 UTC (rev 3135)
@@ -35,9 +35,12 @@
SEXP eigen_wrap_is_plain( const T& obj, ::Rcpp::traits::true_type ){
// FIXME: deal with RowMajor, etc ...
const int RTYPE = Rcpp::traits::r_sexptype_traits<typename T::Scalar>::rtype ;
- Rcpp::Vector<RTYPE> x( obj.data(), obj.data() + obj.size() ) ;
- // TODO: deal with dimensions
- return x ;
+ if( obj.cols() == 1 ) {
+ return wrap( obj.data(), obj.data() + obj.size() ) ;
+ } else {
+ Rcpp::Matrix<RTYPE> x( obj.rows(), obj.cols(), obj.data() ) ;
+ return x;
+ }
}
// when the object is not plain, we need to eval()uate it
More information about the Rcpp-commits
mailing list