[Rcpp-commits] r723 - in pkg/RcppArmadillo: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 17 13:51:50 CET 2010
Author: romain
Date: 2010-02-17 13:51:49 +0100 (Wed, 17 Feb 2010)
New Revision: 723
Modified:
pkg/RcppArmadillo/DESCRIPTION
pkg/RcppArmadillo/src/RcppArmadillo.h
Log:
use SimpleMatrix constructor so that we don't have to do the check 'is it a matrix' manually
Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION 2010-02-17 12:41:38 UTC (rev 722)
+++ pkg/RcppArmadillo/DESCRIPTION 2010-02-17 12:51:49 UTC (rev 723)
@@ -8,6 +8,6 @@
Description: The package eases integration of armadillo types with Rcpp
License: GPL-2
LazyLoad: yes
-Depends: Rcpp (>= 0.7.7.2)
+Depends: Rcpp (>= 0.7.7.3)
SystemRequirements: armadillo
Packaged: 2010-02-16 14:17:09 UTC; romain
Modified: pkg/RcppArmadillo/src/RcppArmadillo.h
===================================================================
--- pkg/RcppArmadillo/src/RcppArmadillo.h 2010-02-17 12:41:38 UTC (rev 722)
+++ pkg/RcppArmadillo/src/RcppArmadillo.h 2010-02-17 12:51:49 UTC (rev 723)
@@ -125,10 +125,7 @@
/* when a cast is needed */
template <typename T> ::arma::Mat<T> convert_Mat__dispatch( SEXP x, T, ::Rcpp::traits::true_type ){
- if( !Rf_isMatrix(x) ){
- throw std::range_error( "not a matrix" ) ;
- }
- ::Rcpp::SimpleVector< ::Rcpp::traits::r_sexptype_traits<T>::rtype > input(x);
+ ::Rcpp::SimpleMatrix< ::Rcpp::traits::r_sexptype_traits<T>::rtype > input(x);
::Rcpp::IntegerVector dim = input.attr("dim") ;
::arma::Mat<T> out( dim[0], dim[1] ) ;
int n = dim[0] * dim[1] ;
@@ -138,10 +135,7 @@
/* when no cast is needed */
template <typename T> ::arma::Mat<T> convert_Mat__dispatch( SEXP x, T, ::Rcpp::traits::false_type ){
- if( !Rf_isMatrix(x) ){
- throw std::range_error( "not a matrix" ) ;
- }
- ::Rcpp::SimpleVector< ::Rcpp::traits::r_sexptype_traits<T>::rtype > input(x);
+ ::Rcpp::SimpleMatrix< ::Rcpp::traits::r_sexptype_traits<T>::rtype > input(x);
::Rcpp::IntegerVector dim = input.attr("dim") ;
::arma::Mat<T> out( dim[0], dim[1] ) ;
int n = dim[0] * dim[1] ;
@@ -196,9 +190,8 @@
return convert_Row__dispatch( x, t, typename ::Rcpp::traits::r_sexptype_needscast<T>() ) ;
}
+} /* namespace RcppArmadillo */
-}
-
/* as */
#define GENERATE_CONVERTERS(TYPE) \
More information about the Rcpp-commits
mailing list