[Rcpp-commits] r2571 - in pkg: Rcpp/inst/include/Rcpp RcppGSL/inst/examples/RcppGSLExample/src RcppGSL/inst/include
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 28 23:13:29 CET 2010
Author: romain
Date: 2010-11-28 23:13:29 +0100 (Sun, 28 Nov 2010)
New Revision: 2571
Modified:
pkg/Rcpp/inst/include/Rcpp/Symbol.h
pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp
pkg/RcppGSL/inst/include/RcppGSLForward.h
Log:
make vector public in vector_view
Modified: pkg/Rcpp/inst/include/Rcpp/Symbol.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Symbol.h 2010-11-28 21:29:54 UTC (rev 2570)
+++ pkg/Rcpp/inst/include/Rcpp/Symbol.h 2010-11-28 22:13:29 UTC (rev 2571)
@@ -52,6 +52,7 @@
*/
~Symbol() ;
+ inline const char* c_str(){ return CHAR(PRINTNAME(m_sexp)) ; }
};
} // namespace Rcpp
Modified: pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp
===================================================================
--- pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp 2010-11-28 21:29:54 UTC (rev 2570)
+++ pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp 2010-11-28 22:13:29 UTC (rev 2571)
@@ -36,11 +36,10 @@
for (int j = 0; j < k; j++) {
RcppGSL::vector_view<double> colview = gsl_matrix_column (M, j);
- RcppGSL::vector<double> col2( Rcpp::wrap(colview) ); // ugly !!
+ RcppGSL::vector<double> col2( colview.vector );
n[j] = gsl_blas_dnrm2(col2);
- col2.free(); // even uglier !!
}
- gsl_matrix_free (M);
+ M.free() ;
return n; // return vector
} catch( std::exception &ex ) {
Modified: pkg/RcppGSL/inst/include/RcppGSLForward.h
===================================================================
--- pkg/RcppGSL/inst/include/RcppGSLForward.h 2010-11-28 21:29:54 UTC (rev 2570)
+++ pkg/RcppGSL/inst/include/RcppGSLForward.h 2010-11-28 22:13:29 UTC (rev 2571)
@@ -130,18 +130,17 @@
typedef typename vector_view_type<T>::type view_type ;
typedef typename vector<T>::Proxy Proxy ;
- vector_view( view_type view_ ) : view(view_), vec(&view_.vector) {}
+ vector_view( view_type view_ ) : view(view_), vector(&view_.vector) {}
inline operator view_type(){ return view ; }
inline Proxy operator[]( int i){
- return vec[i] ;
+ return vector[i] ;
}
- inline iterator begin(){ return vec.begin() ; }
- inline iterator end(){ return vec.end() ; }
- inline size_t size(){ return vec.size(); }
+ inline iterator begin(){ return vector.begin() ; }
+ inline iterator end(){ return vector.end() ; }
+ inline size_t size(){ return vector.size(); }
view_type view ;
-private:
- VEC vec ;
+ VEC vector ;
} ;
template <typename T> class matrix_view {
More information about the Rcpp-commits
mailing list