[Rcpp-commits] r2595 - in pkg/RcppGSL: . R inst/examples/RcppGSLExample/src inst/include

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 29 18:06:22 CET 2010


Author: romain
Date: 2010-11-29 18:06:22 +0100 (Mon, 29 Nov 2010)
New Revision: 2595

Modified:
   pkg/RcppGSL/ChangeLog
   pkg/RcppGSL/R/inline.R
   pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp
   pkg/RcppGSL/inst/include/RcppGSLForward.h
Log:
conversion operators

Modified: pkg/RcppGSL/ChangeLog
===================================================================
--- pkg/RcppGSL/ChangeLog	2010-11-29 17:05:43 UTC (rev 2594)
+++ pkg/RcppGSL/ChangeLog	2010-11-29 17:06:22 UTC (rev 2595)
@@ -1,3 +1,10 @@
+2010-11-29  Romain Francois <romain at r-enthusiasts.com>
+
+	* inst/include/RcppGSLForward.h: vector_view<T> now exposes a conversion 
+	operator to implicitely convert it to the associated gsl_vector_foo * type. 
+	Similarly matrix_view<T> expose a conversion operator to the associated
+	gsl matrix pointer 
+
 2010-11-28  Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/RcppGSLForward.h: vector_view<T> now exposes a public data

Modified: pkg/RcppGSL/R/inline.R
===================================================================
--- pkg/RcppGSL/R/inline.R	2010-11-29 17:05:43 UTC (rev 2594)
+++ pkg/RcppGSL/R/inline.R	2010-11-29 17:06:22 UTC (rev 2595)
@@ -19,6 +19,6 @@
 	include.before = "#include <RcppGSL.h>",
 	#LinkingTo     = unique( c( package, "Rcpp", "RcppGSL" ) ),
 	#Depends       = unique( c( package, "Rcpp", "RcppGSL" ) ),
-	libs           = "-L/usr/lib -lgsl -lm $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)",
+	libs           = "-L/usr/local/lib -lgsl -lm $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)",
 	package        = "RcppGSL"
 )

Modified: pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp
===================================================================
--- pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp	2010-11-29 17:05:43 UTC (rev 2594)
+++ pkg/RcppGSL/inst/examples/RcppGSLExample/src/colNorm.cpp	2010-11-29 17:06:22 UTC (rev 2595)
@@ -36,7 +36,7 @@
 
 		for (int j = 0; j < k; j++) {
 			RcppGSL::vector_view<double> colview = gsl_matrix_column (M, j);
-			n[j] = gsl_blas_dnrm2(colview.getVector());
+			n[j] = gsl_blas_dnrm2(colview);
 		}
 		M.free() ;
 		return n;							// return vector  

Modified: pkg/RcppGSL/inst/include/RcppGSLForward.h
===================================================================
--- pkg/RcppGSL/inst/include/RcppGSLForward.h	2010-11-29 17:05:43 UTC (rev 2594)
+++ pkg/RcppGSL/inst/include/RcppGSLForward.h	2010-11-29 17:06:22 UTC (rev 2595)
@@ -138,8 +138,10 @@
 	inline iterator begin(){ return vector_.begin() ; }
 	inline iterator end(){ return vector_.end() ; }
 	inline size_t size(){ return vector_.size(); }
-	inline VEC & getVector() { return vector_; }
+	inline operator gsltype*(){ return vector_.data ; }
+	
 	view_type view ;
+	
 private:
 	VEC vector_;
 } ;
@@ -160,7 +162,7 @@
 	inline size_t nrow(){ return matrix_.nrow() ; }              
 	inline size_t ncol(){ return matrix_.ncol() ; }              
 	inline size_t size(){ return matrix_.size() ; }
-	inline MAT & getMatrix() { return matrix_; }
+	inline operator gsltype*(){ return matrix_.data ; }
 	view_type view ;
 private:
 	MAT matrix_ ;



More information about the Rcpp-commits mailing list