[Rcpp-commits] r1783 - in pkg/Rcpp/inst: include/Rcpp/internal include/Rcpp/vector unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 5 21:18:52 CEST 2010
Author: romain
Date: 2010-07-05 21:18:52 +0200 (Mon, 05 Jul 2010)
New Revision: 1783
Modified:
pkg/Rcpp/inst/include/Rcpp/internal/wrap_forward.h
pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
pkg/Rcpp/inst/include/Rcpp/vector/MatrixColumn.h
pkg/Rcpp/inst/include/Rcpp/vector/MatrixRow.h
pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
pkg/Rcpp/inst/unitTests/runit.Column.R
pkg/Rcpp/inst/unitTests/runit.Row.R
Log:
disambiguating
Modified: pkg/Rcpp/inst/include/Rcpp/internal/wrap_forward.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/internal/wrap_forward.h 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/include/Rcpp/internal/wrap_forward.h 2010-07-05 19:18:52 UTC (rev 1783)
@@ -31,16 +31,6 @@
return x ;
}
-namespace internal{
- template <typename T>
- class WrapIterableExtraStepsHelper {
- public:
- WrapIterableExtraStepsHelper( const T& ) {
- Rprintf( "default WrapIterableExtraStepsHelper %s\n", DEMANGLE(T) ) ;
- }
- inline SEXP get( SEXP x ) const { return x ; }
- } ;
-} // internal
} // Rcpp
#endif
Modified: pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h 2010-07-05 19:18:52 UTC (rev 1783)
@@ -158,6 +158,15 @@
return VECTOR::dims()[0];
}
+ typedef MatrixRow<RTYPE> Row ;
+ typedef MatrixColumn<RTYPE> Column ;
+
+ inline Row row( int i ){ return Row( *this, i ) ; }
+ inline Column column( int i ){ return Column(*this, i ) ; }
+
+ inline iterator begin() const{ return VECTOR::begin() ; }
+ inline iterator end() const{ return VECTOR::end() ; }
+
} ;
Modified: pkg/Rcpp/inst/include/Rcpp/vector/MatrixColumn.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/MatrixColumn.h 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/include/Rcpp/vector/MatrixColumn.h 2010-07-05 19:18:52 UTC (rev 1783)
@@ -26,13 +26,12 @@
template <int RTYPE>
class MatrixColumn {
public:
- typedef Vector<RTYPE> VECTOR ;
- typedef typename VECTOR::Proxy Proxy ;
- typedef typename VECTOR::value_type value_type ;
- typedef typename VECTOR::iterator iterator ;
+ typedef Matrix<RTYPE> MATRIX ;
+ typedef typename MATRIX::Proxy Proxy ;
+ typedef typename MATRIX::value_type value_type ;
+ typedef typename MATRIX::iterator iterator ;
- MatrixColumn( VECTOR& object, int i ) : parent(object), index(i){
- if( ! ::Rf_isMatrix(parent) ) throw not_a_matrix() ;
+ MatrixColumn( MATRIX& object, int i ) : parent(object), index(i){
if( i < 0 || i >= parent.ncol() ) throw index_out_of_bounds() ;
}
@@ -61,7 +60,7 @@
}
private:
- VECTOR& parent;
+ MATRIX& parent;
int index ;
} ;
Modified: pkg/Rcpp/inst/include/Rcpp/vector/MatrixRow.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/MatrixRow.h 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/include/Rcpp/vector/MatrixRow.h 2010-07-05 19:18:52 UTC (rev 1783)
@@ -25,10 +25,9 @@
template <int RTYPE>
class MatrixRow {
public:
- typedef Vector<RTYPE> VECTOR ;
- typedef typename VECTOR::Proxy Proxy ;
- typedef typename VECTOR::Proxy reference ;
- // typedef typename VECTOR::value_type value_type ;
+ typedef Matrix<RTYPE> MATRIX ;
+ typedef typename MATRIX::Proxy Proxy ;
+ typedef typename MATRIX::Proxy reference ;
class iterator {
public:
@@ -90,8 +89,7 @@
int index ;
} ;
- MatrixRow( VECTOR& object, int i ) : parent(object), index(i){
- if( ! ::Rf_isMatrix(parent) ) throw not_a_matrix() ;
+ MatrixRow( MATRIX& object, int i ) : parent(object), index(i){
if( i < 0 || i >= parent.nrow() ) throw index_out_of_bounds() ;
}
@@ -121,7 +119,7 @@
}
private:
- VECTOR& parent;
+ MATRIX& parent;
int index ;
} ;
Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2010-07-05 19:18:52 UTC (rev 1783)
@@ -36,8 +36,6 @@
typedef typename traits::init_type<RTYPE>::type init_type ;
typedef typename traits::r_vector_element_converter<RTYPE>::type converter_type ;
typedef typename traits::storage_type<RTYPE>::type stored_type ;
- typedef MatrixRow<RTYPE> Row ;
- typedef MatrixColumn<RTYPE> Column ;
Vector() : RObject() {
RCPP_DEBUG( "Vector()" ) ;
@@ -265,9 +263,6 @@
return NamesProxy(*this) ;
}
- inline Row row( int i ){ return Row( *this, i ) ; }
- inline Column column( int i ){ return Column(*this, i ) ; }
-
inline iterator begin() const{ return cache.get() ; }
inline iterator end() const{ return cache.get(size()) ; }
Modified: pkg/Rcpp/inst/unitTests/runit.Column.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Column.R 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/unitTests/runit.Column.R 2010-07-05 19:18:52 UTC (rev 1783)
@@ -29,8 +29,8 @@
test.CharacterMatrix.column <- function(){
funx <- cppfunction(signature(x = "matrix" ), '
- CharacterVector m(x) ;
- CharacterVector::Column col = m.column(0) ;
+ CharacterMatrix m(x) ;
+ CharacterMatrix::Column col = m.column(0) ;
std::string res(
std::accumulate(
col.begin(), col.end(), std::string() ) ) ;
@@ -44,8 +44,8 @@
test.List.column <- function(){
funx <- cppfunction(signature(x = "matrix" ), '
- List m(x) ;
- List::Column col = m.column(0) ;
+ GenericMatrix m(x) ;
+ GenericMatrix::Column col = m.column(0) ;
IntegerVector out( col.size() ) ;
std::transform(
col.begin(), col.end(),
@@ -60,4 +60,3 @@
}
-
Modified: pkg/Rcpp/inst/unitTests/runit.Row.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Row.R 2010-07-05 13:17:42 UTC (rev 1782)
+++ pkg/Rcpp/inst/unitTests/runit.Row.R 2010-07-05 19:18:52 UTC (rev 1783)
@@ -29,8 +29,8 @@
test.CharacterMatrix.row <- function(){
funx <- cppfunction(signature(x = "matrix" ), '
- CharacterVector m(x) ;
- CharacterVector::Row first_row = m.row(0) ;
+ CharacterMatrix m(x) ;
+ CharacterMatrix::Row first_row = m.row(0) ;
std::string res(
std::accumulate(
first_row.begin(), first_row.end(), std::string() ) ) ;
@@ -44,8 +44,8 @@
test.List.row <- function(){
funx <- cppfunction(signature(x = "matrix" ), '
- List m(x) ;
- List::Row first_row = m.row(0) ;
+ GenericMatrix m(x) ;
+ GenericMatrix::Row first_row = m.row(0) ;
IntegerVector out( first_row.size() ) ;
std::transform(
first_row.begin(), first_row.end(),
More information about the Rcpp-commits
mailing list