[Rcpp-commits] r2098 - in pkg: Rcpp/inst/unitTests RcppArmadillo RcppArmadillo/inst/include RcppArmadillo/inst/include/RcppArmadillo RcppArmadillo/inst/include/armadillo_bits

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 10 14:03:21 CEST 2010


Author: romain
Date: 2010-09-10 14:03:21 +0200 (Fri, 10 Sep 2010)
New Revision: 2098

Added:
   pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_proto.hpp
Modified:
   pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h
   pkg/RcppArmadillo/inst/include/armadillo
   pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/access.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_cube_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_cube_core_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/field_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_accu.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_ones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randn.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randu.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_zeros.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_max_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_mean_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_min_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_sum_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_field_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/typedef.hpp
Log:
dumping armadillo 0.9.70 (more to do)

Modified: pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Module.client.package.R	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/Rcpp/inst/unitTests/runit.Module.client.package.R	2010-09-10 12:03:21 UTC (rev 2098)
@@ -1,6 +1,6 @@
 #!/usr/bin/r -t
 #
-# Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+# Copyright (C) 2010	John Chambers, Dirk Eddelbuettel and Romain Francois
 #
 # This file is part of Rcpp.
 #

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/RcppArmadillo/DESCRIPTION	2010-09-10 12:03:21 UTC (rev 2098)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.5.1
+Version: 0.2.5.2
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Romain, Dirk and Doug <RcppArmadillo-authors at r-enthusiasts.com>
@@ -28,7 +28,7 @@
  capabilities of the Rcpp package for seamless R and C++ integration.
 License: GPL (>= 2)
 LazyLoad: yes
-Depends: R (>= 2.10.0), Rcpp (>= 0.8.5.8)
+Depends: R (>= 2.10.0), Rcpp (>= 0.8.6)
 LinkingTo: Rcpp
 Suggests: inline, RUnit
 SystemRequirements: GNU make

Modified: pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h
===================================================================
--- pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h	2010-09-10 12:03:21 UTC (rev 2098)
@@ -28,7 +28,6 @@
 	: n_rows( 0 )
 	, n_cols( 0 )
 	, n_elem( 0 )
-	, use_aux_mem(false)
 	, mem(mem)
 {
 	
@@ -52,7 +51,6 @@
 	: n_rows( 0 )
 	, n_cols( 0 )
 	, n_elem( 0 )
-	, use_aux_mem(false)
 	, mem(mem)
 {
 	

Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/RcppArmadillo/inst/include/armadillo	2010-09-10 12:03:21 UTC (rev 2098)
@@ -127,6 +127,7 @@
   // class prototypes
   
   #include "armadillo_bits/syslib_proto.hpp"
+  #include "armadillo_bits/arrayops_proto.hpp"
   #include "armadillo_bits/podarray_proto.hpp"
   
   #include "armadillo_bits/blas_proto.hpp"

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2010-09-10 12:03:21 UTC (rev 2098)
@@ -22,9 +22,10 @@
 template<typename eT>
 inline
 Col<eT>::Col()
-  : Mat<eT>()
   {
   arma_extra_debug_sigprint();
+  
+  access::rw(Mat<eT>::vec_state) = 1;
   }
 
 
@@ -33,9 +34,12 @@
 template<typename eT>
 inline
 Col<eT>::Col(const u32 in_n_elem)
-  : Mat<eT>(in_n_elem, 1)
   {
   arma_extra_debug_sigprint();
+  
+  access::rw(Mat<eT>::vec_state) = 1;
+  
+  Mat<eT>::init(in_n_elem, 1);
   }
 
 
@@ -43,11 +47,12 @@
 template<typename eT>
 inline
 Col<eT>::Col(const u32 in_n_rows, const u32 in_n_cols)
-  : Mat<eT>(in_n_rows, in_n_cols)
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
+  
+  Mat<eT>::init(in_n_rows, in_n_cols);
   }
 
 
@@ -56,13 +61,16 @@
 template<typename eT>
 inline
 Col<eT>::Col(const char* text)
-  : Mat<eT>(text)
   {
   arma_extra_debug_sigprint();
   
+  access::rw(Mat<eT>::vec_state) = 2;
+  
+  Mat<eT>::operator=(text);
+  
   std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
   }
 
 
@@ -75,11 +83,13 @@
   {
   arma_extra_debug_sigprint();
   
+  access::rw(Mat<eT>::vec_state) = 2;
+  
   Mat<eT>::operator=(text);
   
   std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
   
   return *this;
   }
@@ -90,13 +100,16 @@
 template<typename eT>
 inline
 Col<eT>::Col(const std::string& text)
-  : Mat<eT>(text)
   {
   arma_extra_debug_sigprint();
   
+  access::rw(Mat<eT>::vec_state) = 2;
+  
+  Mat<eT>::operator=(text);
+  
   std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
   }
 
 
@@ -109,84 +122,57 @@
   {
   arma_extra_debug_sigprint();
   
+  access::rw(Mat<eT>::vec_state) = 2;
+  
   Mat<eT>::operator=(text);
   
   std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
   
   return *this;
   }
 
 
 
-//! construct a column vector from a given column vector
 template<typename eT>
 inline
-Col<eT>::Col(const Col<eT>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  }
-
-
-
-//! construct a column vector from a given column vector
-template<typename eT>
-inline
 const Col<eT>&
-Col<eT>::operator=(const Col<eT>& X)
+Col<eT>::operator=(const eT val)
   {
   arma_extra_debug_sigprint();
   
-  Mat<eT>::operator=(X);
+  Mat<eT>::operator=(val);
   
   return *this;
   }
 
 
 
-//! construct a column vector from a given matrix; the matrix must have exactly one column
 template<typename eT>
+template<typename T1>
 inline
-Col<eT>::Col(const Mat<eT>& X)
-  : Mat<eT>(X)
+Col<eT>::Col(const Base<eT,T1>& X)
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-//! construct a column vector from a given matrix; the matrix must have exactly one column
-template<typename eT>
-inline
-const Col<eT>&
-Col<eT>::operator=(const Mat<eT>& X)
-  {
-  arma_extra_debug_sigprint();
+  access::rw(Mat<eT>::vec_state) = 1;
   
-  Mat<eT>::operator=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
+  Mat<eT>::operator=(X.get_ref());
   }
 
 
 
 template<typename eT>
+template<typename T1>
 inline
 const Col<eT>&
-Col<eT>::operator*=(const Mat<eT>& X)
+Col<eT>::operator=(const Base<eT,T1>& X)
   {
   arma_extra_debug_sigprint();
   
-  Mat<eT>::operator*=(X);
+  Mat<eT>::operator=(X.get_ref());
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
   return *this;
   }
 
@@ -195,12 +181,12 @@
 //! construct a column vector from a given auxiliary array of eTs
 template<typename eT>
 inline
-Col<eT>::Col(eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const bool copy_aux_mem)
-  : Mat<eT>(aux_mem, aux_n_rows, aux_n_cols, copy_aux_mem)
+Col<eT>::Col(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem, const bool strict)
+  : Mat<eT>(aux_mem, aux_length, 1, copy_aux_mem, strict)
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
   }
 
 
@@ -208,46 +194,12 @@
 //! construct a column vector from a given auxiliary array of eTs
 template<typename eT>
 inline
-Col<eT>::Col(const eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols)
-  : Mat<eT>(aux_mem, aux_n_rows, aux_n_cols)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-//! construct a column vector from a given auxiliary array of eTs
-template<typename eT>
-inline
-Col<eT>::Col(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem)
-  : Mat<eT>(aux_mem, aux_length, 1, copy_aux_mem)
-  {
-  arma_extra_debug_sigprint();
-  
-//   set_size(aux_length, 1);
-// 
-//   arma_check( (Mat<eT>::n_elem != aux_length), "Col::Col(): don't know how to handle the given array" );
-// 
-//   syslib::copy_elem( Mat<eT>::memptr(), aux_mem, Mat<eT>::n_elem );
-  }
-
-
-
-//! construct a column vector from a given auxiliary array of eTs
-template<typename eT>
-inline
 Col<eT>::Col(const eT* aux_mem, const u32 aux_length)
   : Mat<eT>(aux_mem, aux_length, 1)
   {
   arma_extra_debug_sigprint();
   
-//   set_size(aux_length, 1);
-// 
-//   arma_check( (Mat<eT>::n_elem != aux_length), "Col::Col(): don't know how to handle the given array" );
-// 
-//   syslib::copy_elem( Mat<eT>::memptr(), aux_mem, Mat<eT>::n_elem );
+  access::rw(Mat<eT>::vec_state) = 1;
   }
 
 
@@ -260,70 +212,26 @@
   const Base<typename Col<eT>::pod_type, T1>& A,
   const Base<typename Col<eT>::pod_type, T2>& B
   )
-  : Mat<eT>(A,B)
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-//! construct a column vector from given a submatrix; the submatrix must have exactly one column
-template<typename eT>
-inline
-Col<eT>::Col(const subview<eT>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
+  access::rw(Mat<eT>::vec_state) = 1;
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  Mat<eT>::init(A,B);
   }
 
 
 
-//! construct a column vector from given a submatrix; the submatrix must have exactly one column
-template<typename eT>
-inline
-const Col<eT>&
-Col<eT>::operator=(const subview<eT>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const subview<eT>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
 //! construct a column vector from given a subcube; the subcube must have exactly one column
 template<typename eT>
 inline
 Col<eT>::Col(const subview_cube<eT>& X)
-  : Mat<eT>(X)
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+  access::rw(Mat<eT>::vec_state) = 1;
+  
+  Mat<eT>::operator=(X);
   }
 
 
@@ -338,8 +246,6 @@
   
   Mat<eT>::operator=(X);
   
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
   return *this;
   }
 
@@ -347,68 +253,6 @@
 
 template<typename eT>
 inline
-const Col<eT>&
-Col<eT>::operator*=(const subview_cube<eT>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-//! construct a column vector from given a diagview
-template<typename eT>
-inline
-Col<eT>::Col(const diagview<eT>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-//! construct a column vector from given a diagview
-template<typename eT>
-inline
-const Col<eT>&
-Col<eT>::operator=(const diagview<eT>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const diagview<eT>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-inline
 mat_injector< Col<eT> >
 Col<eT>::operator<<(const eT val)
   {
@@ -467,482 +311,8 @@
 
 
 
-//! construct a column vector from Op, i.e. run the previously delayed operations; the result of the operations must have exactly one column
 template<typename eT>
-template<typename T1, typename op_type>
 inline
-Col<eT>::Col(const Op<T1, op_type>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-//! construct a column vector from Op, i.e. run the previously delayed operations; the result of the operations must have exactly one column
-template<typename eT>
-template<typename T1, typename op_type>
-inline
-const Col<eT>&
-Col<eT>::operator=(const Op<T1, op_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename op_type>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const Op<T1, op_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename eop_type>
-inline
-Col<eT>::Col(const eOp<T1, eop_type>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename eop_type>
-inline
-const Col<eT>&
-Col<eT>::operator=(const eOp<T1, eop_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename eop_type>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const eOp<T1, eop_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename op_type>
-inline
-Col<eT>::Col(const mtOp<eT, T1, op_type>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename op_type>
-inline
-const Col<eT>&
-Col<eT>::operator=(const mtOp<eT, T1, op_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename op_type>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const mtOp<eT, T1, op_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-//! construct a column vector from Glue, i.e. run the previously delayed operations; the result of the operations must have exactly one column
-template<typename eT>
-template<typename T1, typename T2, typename glue_type>
-inline
-Col<eT>::Col(const Glue<T1, T2, glue_type>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-//! construct a column vector from Glue, i.e. run the previously delayed operations; the result of the operations must have exactly one column
-template<typename eT>
-template<typename T1, typename T2, typename glue_type>
-inline
-const Col<eT>&
-Col<eT>::operator=(const Glue<T1, T2, glue_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename glue_type>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const Glue<T1, T2, glue_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename eglue_type>
-inline
-Col<eT>::Col(const eGlue<T1, T2, eglue_type>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename eglue_type>
-inline
-const Col<eT>&
-Col<eT>::operator=(const eGlue<T1, T2, eglue_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename eglue_type>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const eGlue<T1, T2, eglue_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename glue_type>
-inline
-Col<eT>::Col(const mtGlue<eT, T1, T2, glue_type>& X)
-  : Mat<eT>(X)
-  {
-  arma_extra_debug_sigprint();
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename glue_type>
-inline
-const Col<eT>&
-Col<eT>::operator=(const mtGlue<eT, T1, T2, glue_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<typename T1, typename T2, typename glue_type>
-inline
-const Col<eT>&
-Col<eT>::operator*=(const mtGlue<eT, T1, T2, glue_type>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::operator*=(X);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  
-  return *this;
-  }
-
-
-
-//! change the number of rows
-template<typename eT>
-inline
-void
-Col<eT>::set_size(const u32 in_n_elem)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::set_size(in_n_elem,1);
-  }
-
-
-
-//! change the number of n_rows  (this function re-implements mat::set_size() in order to check the number of columns)
-template<typename eT>
-inline
-void
-Col<eT>::set_size(const u32 in_n_rows, const u32 in_n_cols)
-  {
-  arma_extra_debug_sigprint();
-
-  // min() is used in case in_n_cols is zero
-  Mat<eT>::set_size( in_n_rows, (std::min)( u32(1), in_n_cols ) );
-  
-  arma_debug_check( (in_n_cols > 1), "Col::set_size(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::reshape(const u32 in_rows, const u32 in_cols, const u32 dim)
-  {
-  arma_extra_debug_sigprint();
-
-  Mat<eT>::reshape(in_rows, in_cols, dim);
-  
-  arma_debug_check( (in_cols > 1), "Col::set_size(): incompatible dimensions" );
-  }
-
-
-
-//! change the number of n_rows  (this function re-implements mat::copy_size() in order to check the number of columns)
-template<typename eT>
-template<typename eT2>
-inline
-void
-Col<eT>::copy_size(const Mat<eT2>& x)
-  {
-  arma_extra_debug_sigprint();
-  
-  // min() is used in case x.n_cols is zero
-  Mat<eT>::set_size( x.n_rows, (std::min)( u32(1), x.n_cols ) );
-  
-  arma_debug_check( (x.n_cols > 1), "Col::copy_size(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::zeros()
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::zeros();
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::zeros(const u32 in_n_elem)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::zeros(in_n_elem, 1);
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::zeros(const u32 in_n_rows, const u32 in_n_cols)
-  {
-  arma_extra_debug_sigprint();
-  
-  // min() is used in case in_n_cols is zero
-  Mat<eT>::zeros( in_n_rows, (std::min)( u32(1), in_n_cols ) );
-  
-  arma_debug_check( (in_n_cols > 1), "Col::zeros(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::ones()
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::ones();
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::ones(const u32 in_n_elem)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::ones(in_n_elem, 1);
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::ones(const u32 in_n_rows, const u32 in_n_cols)
-  {
-  arma_extra_debug_sigprint();
-  
-  // min() is used in case in_n_cols is zero
-  Mat<eT>::ones( in_n_rows, (std::min)( u32(1), in_n_cols ) );
-  
-  arma_debug_check( (in_n_cols > 1), "Col::ones(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::load(const std::string name, const file_type type, const bool print_status)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::load(name, type, print_status);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::load(std::istream& is, const file_type type, const bool print_status)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::load(is, type, print_status);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::quiet_load(const std::string name, const file_type type)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::quiet_load(name, type);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
-void
-Col<eT>::quiet_load(std::istream& is, const file_type type)
-  {
-  arma_extra_debug_sigprint();
-  
-  Mat<eT>::quiet_load(is, type);
-  
-  arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
-  }
-
-
-
-template<typename eT>
-inline
 typename Col<eT>::row_iterator
 Col<eT>::begin_row(const u32 row_num)
   {
@@ -997,6 +367,36 @@
 
 
 
+template<typename eT>
+template<u32 fixed_n_elem>
+arma_inline
+void
+Col<eT>::fixed<fixed_n_elem>::mem_setup()
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  if(fixed_n_elem > 0)
+    {
+    access::rw(Mat<eT>::n_rows)    = fixed_n_elem;
+    access::rw(Mat<eT>::n_cols)    = 1;
+    access::rw(Mat<eT>::n_elem)    = fixed_n_elem;
+    access::rw(Mat<eT>::vec_state) = 1;
+    access::rw(Mat<eT>::mem_state) = 3;
+    access::rw(Mat<eT>::mem)       = (fixed_n_elem > Mat_prealloc::mem_n_elem) ? mem_local_extra : Mat<eT>::mem_local;
+    }
+  else
+    {
+    access::rw(Mat<eT>::n_rows)    = 0;
+    access::rw(Mat<eT>::n_cols)    = 0;
+    access::rw(Mat<eT>::n_elem)    = 0;
+    access::rw(Mat<eT>::vec_state) = 1;
+    access::rw(Mat<eT>::mem_state) = 3;
+    access::rw(Mat<eT>::mem)       = 0;
+    }
+  }
+
+
+
 #ifdef ARMA_EXTRA_COL_MEAT
   #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT)
 #endif

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp	2010-09-10 12:03:21 UTC (rev 2098)
@@ -28,44 +28,29 @@
   typedef typename get_pod_type<eT>::result pod_type;
   
   
-  inline                     Col();
-  inline explicit            Col(const u32 n_elem);
-  inline                     Col(const u32 in_rows, const u32 in_cols);
+  inline          Col();
+  inline explicit Col(const u32 n_elem);
+  inline          Col(const u32 in_rows, const u32 in_cols);
   
-  inline                     Col(const char*        text);
-  inline const Col&    operator=(const char*        text);
-  inline                     Col(const std::string& text);
-  inline const Col&    operator=(const std::string& text);
+  inline                  Col(const char*        text);
+  inline const Col& operator=(const char*        text);
+  inline                  Col(const std::string& text);
+  inline const Col& operator=(const std::string& text);
   
-  inline                     Col(const Col& X);
-  inline const Col&    operator=(const Col& X);
+  inline const Col& operator=(const eT val);
+    
+  template<typename T1> inline                   Col(const Base<eT,T1>& X);
+  template<typename T1> inline const Col&  operator=(const Base<eT,T1>& X);
   
-  //inline explicit            Col(const Mat<eT>& X);
-  inline                     Col(const Mat<eT>& X);
-  inline const Col&    operator=(const Mat<eT>& X);
-  inline const Col&   operator*=(const Mat<eT>& X);
-  
-  inline Col(      eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const bool copy_aux_mem = true);
-  inline Col(const eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols);
-  
-  inline Col(      eT* aux_mem, const u32 aux_length, const bool copy_aux_mem = true);
+  inline Col(      eT* aux_mem, const u32 aux_length, const bool copy_aux_mem = true, const bool strict = true);
   inline Col(const eT* aux_mem, const u32 aux_length);
   
   template<typename T1, typename T2>
   inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
   
-  inline                     Col(const subview<eT>& X);
-  inline const Col&    operator=(const subview<eT>& X);
-  inline const Col&   operator*=(const subview<eT>& X);
+  inline                  Col(const subview_cube<eT>& X);
+  inline const Col& operator=(const subview_cube<eT>& X);
   
-  inline                     Col(const subview_cube<eT>& X);
-  inline const Col&    operator=(const subview_cube<eT>& X);
-  inline const Col&   operator*=(const subview_cube<eT>& X);
-  
-  inline                     Col(const diagview<eT>& X);
-  inline const Col&    operator=(const diagview<eT>& X);
-  inline const Col&   operator*=(const diagview<eT>& X);
-
   inline mat_injector<Col> operator<<(const eT val);
   
   arma_inline eT& row(const u32 row_num);
@@ -74,53 +59,7 @@
   arma_inline       subview_col<eT> rows(const u32 in_row1, const u32 in_row2);
   arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_row2) const;
   
-  template<typename T1, typename op_type> inline                   Col(const Op<T1, op_type>& X);
-  template<typename T1, typename op_type> inline const Col&  operator=(const Op<T1, op_type>& X);
-  template<typename T1, typename op_type> inline const Col& operator*=(const Op<T1, op_type>& X);
   
-  template<typename T1, typename eop_type> inline                   Col(const eOp<T1, eop_type>& X);
-  template<typename T1, typename eop_type> inline const Col&  operator=(const eOp<T1, eop_type>& X);
-  template<typename T1, typename eop_type> inline const Col& operator*=(const eOp<T1, eop_type>& X);
-  
-  template<typename T1, typename op_type> inline                   Col(const mtOp<eT, T1, op_type>& X);
-  template<typename T1, typename op_type> inline const Col&  operator=(const mtOp<eT, T1, op_type>& X);
-  template<typename T1, typename op_type> inline const Col& operator*=(const mtOp<eT, T1, op_type>& X);
-  
-  template<typename T1, typename T2, typename glue_type> inline                   Col(const Glue<T1, T2, glue_type>& X);
-  template<typename T1, typename T2, typename glue_type> inline const Col&  operator=(const Glue<T1, T2, glue_type>& X);
-  template<typename T1, typename T2, typename glue_type> inline const Col& operator*=(const Glue<T1, T2, glue_type>& X);
-  
-  template<typename T1, typename T2, typename eglue_type> inline                   Col(const eGlue<T1, T2, eglue_type>& X);
-  template<typename T1, typename T2, typename eglue_type> inline const Col&  operator=(const eGlue<T1, T2, eglue_type>& X);
-  template<typename T1, typename T2, typename eglue_type> inline const Col& operator*=(const eGlue<T1, T2, eglue_type>& X);
-  
-  template<typename T1, typename T2, typename glue_type> inline                   Col(const mtGlue<eT, T1, T2, glue_type>& X);
-  template<typename T1, typename T2, typename glue_type> inline const Col&  operator=(const mtGlue<eT, T1, T2, glue_type>& X);
-  template<typename T1, typename T2, typename glue_type> inline const Col& operator*=(const mtGlue<eT, T1, T2, glue_type>& X);
-  
-  inline void  set_size(const u32 n_elem);
-  inline void  set_size(const u32 n_rows, const u32 n_cols);
-  inline void   reshape(const u32 n_rows, const u32 n_cols, const u32 dim = 0);
-  
-  template<typename eT2>
-  inline void copy_size(const Mat<eT2>& m);
-  
-  inline void zeros();
-  inline void zeros(const u32 n_elem);
-  inline void zeros(const u32 n_rows, const u32 n_cols);
-  
-  inline void ones();
-  inline void ones(const u32 n_elem);
-  inline void ones(const u32 n_rows, const u32 n_cols);
-  
-  
-  inline void load(const std::string   name, const file_type type = auto_detect, const bool print_status = true);
-  inline void load(      std::istream& is,   const file_type type = auto_detect, const bool print_status = true);
-  
-  inline void quiet_load(const std::string   name, const file_type type = auto_detect);
-  inline void quiet_load(      std::istream& is,   const file_type type = auto_detect);
-  
-  
   typedef       eT*       row_iterator;
   typedef const eT* const_row_iterator;
   
@@ -131,6 +70,41 @@
   inline const_row_iterator end_row  (const u32 row_num) const;
   
   
+  template<u32 fixed_n_elem>
+  class fixed : public Col<eT>
+    {
+    private:
+    
+    arma_aligned eT mem_local_extra[ ( fixed_n_elem > Mat_prealloc::mem_n_elem ) ? fixed_n_elem : 1 ];
+    
+    arma_inline void mem_setup();
+    arma_inline void swap_rows_cols() { access::rw(Mat<eT>::n_cols) = fixed_n_elem; access::rw(Mat<eT>::n_rows) = 1; }
+    
+    public:
+    
+    inline fixed() { mem_setup(); }
+    
+    inline                fixed(const char*        text) { mem_setup(); swap_rows_cols(); Col<eT>::operator=(text);               }
+    inline const Col& operator=(const char*        text) {              swap_rows_cols(); Col<eT>::operator=(text); return *this; }
+    inline                fixed(const std::string& text) { mem_setup(); swap_rows_cols(); Col<eT>::operator=(text);               }
+    inline const Col& operator=(const std::string& text) {              swap_rows_cols(); Col<eT>::operator=(text); return *this; }
+    
+    inline const Col& operator=(const eT val) { Col<eT>::operator=(val); return *this; }
+    
+    template<typename T1>
+    inline fixed(const Base<eT,T1>& A) { mem_setup(); Col<eT>::operator=(A.get_ref()); }
+    
+    template<typename T1>
+    inline const Col& operator=(const Base<eT,T1>& A) { Col<eT>::operator=(A.get_ref()); return *this; }
+    
+    template<typename T1, typename T2>
+    inline explicit fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B) { mem_setup(); Col<eT>::init(A,B); }
+    
+    inline                fixed(const subview_cube<eT>& X) { mem_setup(); Col<eT>::operator=(X);               }
+    inline const Col& operator=(const subview_cube<eT>& X) {              Col<eT>::operator=(X); return *this; }
+    };
+  
+  
   #ifdef ARMA_EXTRA_COL_PROTO
     #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO)
   #endif

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2010-09-10 11:43:00 UTC (rev 2097)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2010-09-10 12:03:21 UTC (rev 2098)
@@ -26,9 +26,9 @@
   
   delete_mat();
   
-  if(use_aux_mem == false)
+  if(mem_state == 0)
     {
-    if(n_elem > sizeof(mem_local)/sizeof(eT) )
+    if(n_elem > Cube_prealloc::mem_n_elem)
       {
       delete [] mem;
       }
@@ -59,7 +59,7 @@
   , n_elem_slice(0)
   , n_slices(0)
   , n_elem(0)
-  , use_aux_mem(false)
+  , mem_state(0)
   , mat_ptrs(mat_ptrs)
   , mem(mem)
   {
@@ -77,7 +77,7 @@
   , n_elem_slice(0)
   , n_slices(0)
   , n_elem(0)
-  , use_aux_mem(false)
+  , mem_state(0)
   , mat_ptrs(mat_ptrs)
   , mem(mem)
   {
@@ -97,82 +97,131 @@
   {
   arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d, in_n_slices = %d") % in_n_rows % in_n_cols % in_n_slices );
   
-  const u32 new_n_elem = in_n_rows * in_n_cols * in_n_slices;
+  const bool same_size = ( (n_rows == in_n_rows) && (n_cols == in_n_cols) && (n_slices == in_n_slices) );
   
-  if(n_elem == new_n_elem)
+  if(same_size == false)
     {
-    if( (n_rows != in_n_rows) || (n_cols != in_n_cols) || (n_slices != in_n_slices) )
+    arma_debug_check( (mem_state == 3), "Cube::init(): size can't be changed as template based size specification is in use" );
+    
+    const u32 old_n_elem = n_elem;
+    const u32 new_n_elem = in_n_rows * in_n_cols * in_n_slices;
+    
+    if(old_n_elem == new_n_elem)
       {
+      if(same_size == false)
+        {
+        delete_mat();
+        
+        if(new_n_elem > 0)
+          {
+          access::rw(n_rows)       = in_n_rows;
+          access::rw(n_cols)       = in_n_cols;
+          access::rw(n_elem_slice) = in_n_rows*in_n_cols;
+          access::rw(n_slices)     = in_n_slices;
+          
+          create_mat();
+          }
+        }
+      }
+    else
+      {
+      arma_debug_check( (mem_state == 2), "Cube::init(): requested size is not compatible with the size of auxiliary memory" );
+      
       delete_mat();
       
+      if(mem_state == 0)
+        {
+        if(n_elem > Cube_prealloc::mem_n_elem )
+          {
+          arma_extra_debug_print("Cube::init(): freeing memory");
+          
+          delete [] mem;
+          }
+        }
+      
+      access::rw(mem_state) = 0;
+      
+      if(new_n_elem <= Cube_prealloc::mem_n_elem)
+        {
+        access::rw(mem) = mem_local;
+        }
+      else
+        {
+        arma_extra_debug_print("Cube::init(): allocating memory");
+        
+        access::rw(mem) = new(std::nothrow) eT[new_n_elem];
+      
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 2098


More information about the Rcpp-commits mailing list