[Rcpp-commits] r2919 - in pkg/RcppArmadillo: . inst inst/include/RcppArmadillo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 2 14:11:24 CET 2011


Author: edd
Date: 2011-03-02 14:11:24 +0100 (Wed, 02 Mar 2011)
New Revision: 2919

Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/inst/NEWS
   pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h
   pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h
Log:
setting vec_state in Col / Row instantiation from matrix


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2011-02-28 22:36:26 UTC (rev 2918)
+++ pkg/RcppArmadillo/ChangeLog	2011-03-02 13:11:24 UTC (rev 2919)
@@ -1,3 +1,8 @@
+2011-03-02  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/RcppArmadillo/Row_meat.h: Support RTTI via vec_stat
+	* inst/include/RcppArmadillo/Col_meat.h: Support RTTI via vec_stat
+
 2011-02-28  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/doc/Makefile: Call R and Rscript relative to R_HOME/bin

Modified: pkg/RcppArmadillo/inst/NEWS
===================================================================
--- pkg/RcppArmadillo/inst/NEWS	2011-02-28 22:36:26 UTC (rev 2918)
+++ pkg/RcppArmadillo/inst/NEWS	2011-03-02 13:11:24 UTC (rev 2919)
@@ -1,5 +1,9 @@
 0.2.14  2011-ab-cd
 
+    o   Support Run-Time Type Information (RTTI) on matrices by setting the
+        state variable vec_state in Row and Col instantiation, with thanks to
+        Conrad Sanderson for the hint
+
     o   fastLm code simplified further by instantiating the Armadillo matrix
         and vector directly from the SEXP coming from R
 

Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h
===================================================================
--- pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h	2011-02-28 22:36:26 UTC (rev 2918)
+++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Col_meat.h	2011-03-02 13:11:24 UTC (rev 2919)
@@ -1,8 +1,8 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
 // Col_meat.h: Rcpp/Armadillo glue
 //
-// Copyright (C)  2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates
+// Copyright (C)  2011 Dirk Eddelbuettel, Romain Francois and Douglas Bates
 //
 // This file is part of RcppArmadillo.
 //
@@ -25,19 +25,21 @@
 template <typename eT>
 template <int RTYPE, bool NA, typename VECTOR>
 inline Col<eT>::Col( const Rcpp::VectorBase<RTYPE,NA,VECTOR>& X )
-	: Mat<eT>( X )
-	{	
-	arma_extra_debug_sigprint(this);
-	}
+    : Mat<eT>( X ) 
+{	
+    arma_extra_debug_sigprint(this);
+}
 
 template <typename eT>
 template <int RTYPE, bool NA, typename MATRIX>
 inline Col<eT>::Col( const Rcpp::MatrixBase<RTYPE,NA,MATRIX>& X ) 
-	: Mat<eT>( X )
-	{	
-	arma_extra_debug_sigprint(this);
+    : Mat<eT>( X ) 
+{	
+    arma_extra_debug_sigprint(this);
 	
-	arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-	}
+    arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
 
+    access::rw(Mat<eT>::vec_state) = 1;
+}
+
 #endif

Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h
===================================================================
--- pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h	2011-02-28 22:36:26 UTC (rev 2918)
+++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Row_meat.h	2011-03-02 13:11:24 UTC (rev 2919)
@@ -1,8 +1,8 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
 // Row_meat.h: Rcpp/Armadillo glue
 //
-// Copyright (C)  2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates
+// Copyright (C)  2011 Dirk Eddelbuettel, Romain Francois and Douglas Bates
 //
 // This file is part of RcppArmadillo.
 //
@@ -25,20 +25,21 @@
 template <typename eT>
 template <int RTYPE, bool NA, typename VECTOR>
 inline Row<eT>::Row( const Rcpp::VectorBase<RTYPE,NA,VECTOR>& X )
-	: Mat<eT>( X )
-	{	
+	: Mat<eT>( X ) {	
 	arma_extra_debug_sigprint(this);
 	std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
-	}
+}
 
 template <typename eT>
 template <int RTYPE, bool NA, typename MATRIX>
 inline Row<eT>::Row( const Rcpp::MatrixBase<RTYPE,NA,MATRIX>& X ) 
-	: Mat<eT>( X )
-	{	
+	: Mat<eT>( X ) {	
+
 	arma_extra_debug_sigprint(this);
 	
-	arma_debug_check( (Mat<eT>::n_rows > 1), "Col(): incompatible dimensions" );
-	}
+	arma_debug_check( (Mat<eT>::n_rows > 1), "Row(): incompatible dimensions" );
 
+    access::rw(Mat<eT>::vec_state) = 2;
+}
+
 #endif



More information about the Rcpp-commits mailing list