[Rcpp-commits] r2174 - in pkg/RcppArmadillo/inst: include unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Sep 25 18:54:35 CEST 2010
Author: romain
Date: 2010-09-25 18:54:35 +0200 (Sat, 25 Sep 2010)
New Revision: 2174
Modified:
pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h
pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
Log:
workaround
Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h
===================================================================
--- pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2010-09-25 10:31:02 UTC (rev 2173)
+++ pkg/RcppArmadillo/inst/include/RcppArmadilloWrap.h 2010-09-25 16:54:35 UTC (rev 2174)
@@ -1,4 +1,4 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
//
// RcppArmadilloWrap.h: Rcpp/Armadillo glue
//
@@ -104,13 +104,13 @@
memory allocated by R */
template <typename T1, typename T2, typename eglue_type>
SEXP wrap_eglue( const arma::eGlue<T1, T2, eglue_type>& X, ::Rcpp::traits::false_type ){
- int n_rows = X.P1.get_n_rows() ;
- int n_cols = X.P1.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 ;
+ int n_rows = X.P1.get_n_rows() ;
+ int n_cols = X.P1.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 T2, typename eglue_type>
@@ -120,13 +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 ;
+ // 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) ) ;
}
template <typename T1, typename eop_type>
Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
===================================================================
--- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-09-25 10:31:02 UTC (rev 2173)
+++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-09-25 16:54:35 UTC (rev 2174)
@@ -20,8 +20,8 @@
test.wrap.R <- function(){
fx <- cxxfunction( , '
-
- // using the Named(.) = . notation
+
+ // using the Named(.) = . notation
List cols = List::create(
Named( "Col<double>" ) = arma::zeros<arma::mat>(5,1),
Named( "Col<float>" ) = arma::zeros<arma::fmat>(5,1)
More information about the Rcpp-commits
mailing list