[Rcpp-commits] r1227 - in pkg/RcppGSL: inst/include src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 13 14:56:48 CEST 2010


Author: romain
Date: 2010-05-13 14:56:47 +0200 (Thu, 13 May 2010)
New Revision: 1227

Modified:
   pkg/RcppGSL/inst/include/RcppGSLForward.h
   pkg/RcppGSL/src/fastLm.cpp
Log:
adding size, nrow, ncol methods

Modified: pkg/RcppGSL/inst/include/RcppGSLForward.h
===================================================================
--- pkg/RcppGSL/inst/include/RcppGSLForward.h	2010-05-13 12:53:04 UTC (rev 1226)
+++ pkg/RcppGSL/inst/include/RcppGSLForward.h	2010-05-13 12:56:47 UTC (rev 1227)
@@ -125,6 +125,7 @@
 		data = other.data ;                                                      \
 		return *this ;                                                           \
 	}                                                                            \
+	inline size_t size(){ return data->size ; }                                  \
 	void free(){                                                                 \
 		gsl_vector##__SUFFIX__##_free(data) ;                                    \
 	}                                                                            \
@@ -149,6 +150,9 @@
 		data = other.data ;                                                      \
 		return *this ;                                                           \
 	}                                                                            \
+	inline size_t nrow(){ return data->size1 ; }                                 \
+	inline size_t ncol(){ return data->size2 ; }                                 \
+	inline size_t size(){ return data->size1 * data->size2 ; }                   \
 	void free(){                                                                 \
 		gsl_matrix##__SUFFIX__##_free(data) ;                                    \
 	}                                                                            \

Modified: pkg/RcppGSL/src/fastLm.cpp
===================================================================
--- pkg/RcppGSL/src/fastLm.cpp	2010-05-13 12:53:04 UTC (rev 1226)
+++ pkg/RcppGSL/src/fastLm.cpp	2010-05-13 12:56:47 UTC (rev 1227)
@@ -31,7 +31,7 @@
 
 	using Rcpp::_ ;
 
-    int n=X->size1,k=X->size2;
+    int n=X.nrow(),k=X.ncol() ;
     double chisq;
 
     RcppGSL::vector<double> c(k) ;



More information about the Rcpp-commits mailing list