[Rcpp-commits] r4539 - in pkg/RcppArmadillo: . debian inst inst/include/armadillo_bits

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 28 03:45:35 CEST 2013


Author: edd
Date: 2013-09-28 03:45:32 +0200 (Sat, 28 Sep 2013)
New Revision: 4539

Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/debian/changelog
   pkg/RcppArmadillo/inst/NEWS.Rd
   pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_dot.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eig.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_join.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_kron_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
Log:
Armadillo 0.3.920.1 (a minor one-file fix over 0.3.920.0)
forgot to commit the finalized 0.3.920.0 yesterday


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/ChangeLog	2013-09-28 01:45:32 UTC (rev 4539)
@@ -1,10 +1,17 @@
-2013-09-27 Romain Francois <romain at r-enthusiasts.com>
+2013-09-27  Dirk Eddelbuettel  <edd at debian.org>
 
+	* DESCRIPTION: Release 0.3.920.1
+	* inst/NEWS: Release 0.3.920.1
+	* inst/include/*: Upgraded to new release 3.920.1 of Armadillo
+        * debian/*: Similarly updated for new release to Debian
+
+2013-09-27  Romain Francois <romain at r-enthusiasts.com>
+
         * include/RcppArmadilloAs.h : handle cx_mat, using that Rcomplex is
-        layout compatible with std::complex<double>
+	layout compatible with std::complex<double>
         * unitTests/cpp/armadillo.cpp : more testing
         * unitTests/runit.RcppArmadillo.R : more testing
-        
+
 2013-09-23  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/*: Upgraded to Armadillo pre-release of 3.920.0

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/DESCRIPTION	2013-09-28 01:45:32 UTC (rev 4539)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.910.0.2
+Version: 0.3.920.0
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Dirk Eddelbuettel <edd at debian.org>
@@ -21,7 +21,7 @@
  (due to speed and/or integration capabilities), rather than another language.
  .
  The RcppArmadillo package includes the header files from the templated
- Armadillo library (currently version 3.910.0). Thus users do not need to
+ Armadillo library (currently version 3.920.0). Thus users do not need to
  install Armadillo itself in order to use RcppArmadillo.
  .
  This Armadillo integration provides a nice illustration of the 

Modified: pkg/RcppArmadillo/debian/changelog
===================================================================
--- pkg/RcppArmadillo/debian/changelog	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/debian/changelog	2013-09-28 01:45:32 UTC (rev 4539)
@@ -1,3 +1,9 @@
+r-cran-rcpparmadillo (0.3.920.0-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Dirk Eddelbuettel <edd at debian.org>  Thu, 26 Sep 2013 14:27:51 -0500
+
 r-cran-rcpparmadillo (0.3.910.0-1) unstable; urgency=low
 
   * New upstream release

Modified: pkg/RcppArmadillo/inst/NEWS.Rd
===================================================================
--- pkg/RcppArmadillo/inst/NEWS.Rd	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/NEWS.Rd	2013-09-28 01:45:32 UTC (rev 4539)
@@ -2,15 +2,28 @@
 \title{News for Package 'RcppArmadillo'}
 \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
-\section{Changes in RcppArmadillo version (future)}{
+\section{Changes in RcppArmadillo version 0.3.920.1 (2013-09-27)}{
+  \itemize{
+    \item Upgraded to Armadillo release Version 3.920.1 (Agencia
+    Nacional Stasi)
     \itemize{
-      \item Initial implementation of \code{wrap<subview>}
-      \item Improved implementation of \code{as<>()} and \code{wrap()}
-      for sparse matrices
-      \item Converted main vignette from \code{LaTeX} style \code{minted}
-      to \code{lstlisting} which permits builds on CRAN; removed
-      set \code{BuildVignettes: FALSE}.
+      \item faster \code{.zeros()}
+      \item faster \code{round()}, \code{exp2()} and \code{log2()} when using C++11
+      \item added signum function: \code{sign()}
+      \item added move constructors when using C++11
+      \item added 2D fast Fourier transform: \code{fft2()}
+      \item added \code{.tube()} for easier extraction of vectors and subcubes from
+      cubes
+      \item added specification of a fill type during construction of Mat, Col,
+      Row and Cube classes, eg. \code{mat X(4, 5, fill::zeros)}
     }
+    \item Initial implementation of \code{wrap<subview>}
+    \item Improved implementation of \code{as<>()} and \code{wrap()}
+    for sparse matrices
+    \item Converted main vignette from \code{LaTeX} style \code{minted}
+    to \code{lstlisting} which permits builds on CRAN; removed
+    set \code{BuildVignettes: FALSE}.
+  }
 }
 
 \section{Changes in RcppArmadillo version 0.3.910.0 (2013-08-12)}{

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -27,8 +27,8 @@
   inline explicit Col(const uword n_elem);
   inline          Col(const uword in_rows, const uword in_cols);
   
-  template<typename fill_type> inline Col(const uword n_elem,                       const arma::fill::fill_class<fill_type>& f);
-  template<typename fill_type> inline Col(const uword in_rows, const uword in_cols, const arma::fill::fill_class<fill_type>& f);
+  template<typename fill_type> inline Col(const uword n_elem,                       const fill::fill_class<fill_type>& f);
+  template<typename fill_type> inline Col(const uword in_rows, const uword in_cols, const fill::fill_class<fill_type>& f);
   
   inline                  Col(const char*        text);
   inline const Col& operator=(const char*        text);
@@ -77,6 +77,7 @@
   arma_inline eT  row(const uword row_num) const;
   
   using Mat<eT>::rows;
+  using Mat<eT>::operator();
   
   arma_inline       subview_col<eT> rows(const uword in_row1, const uword in_row2);
   arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const;
@@ -84,11 +85,12 @@
   arma_inline       subview_col<eT> subvec(const uword in_row1, const uword in_row2);
   arma_inline const subview_col<eT> subvec(const uword in_row1, const uword in_row2) const;
   
+  arma_inline       subview_col<eT> rows(const span& row_span);
+  arma_inline const subview_col<eT> rows(const span& row_span) const;
+  
   arma_inline       subview_col<eT> subvec(const span& row_span);
   arma_inline const subview_col<eT> subvec(const span& row_span) const;
   
-  using Mat<eT>::operator();
-  
   arma_inline       subview_col<eT> operator()(const span& row_span);
   arma_inline const subview_col<eT> operator()(const span& row_span) const;
   
@@ -165,8 +167,7 @@
   arma_inline fixed(const fixed<fixed_n_elem>& X);
        inline fixed(const subview_cube<eT>& X);
   
-  // TODO: constructor with fill_type
-  
+  template<typename fill_type>       inline fixed(const fill::fill_class<fill_type>& f);
   template<typename T1>              inline fixed(const Base<eT,T1>& A);
   template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -59,7 +59,7 @@
 template<typename eT>
 template<typename fill_type>
 inline
-Col<eT>::Col(const uword in_n_elem, const arma::fill::fill_class<fill_type>& f)
+Col<eT>::Col(const uword in_n_elem, const fill::fill_class<fill_type>& f)
   : Mat<eT>(arma_vec_indicator(), in_n_elem, 1, 1)
   {
   arma_extra_debug_sigprint();
@@ -72,7 +72,7 @@
 template<typename eT>
 template<typename fill_type>
 inline
-Col<eT>::Col(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class<fill_type>& f)
+Col<eT>::Col(const uword in_n_rows, const uword in_n_cols, const fill::fill_class<fill_type>& f)
   : Mat<eT>(arma_vec_indicator(), 0, 0, 1)
   {
   arma_extra_debug_sigprint();
@@ -569,6 +569,30 @@
 template<typename eT>
 arma_inline
 subview_col<eT>
+Col<eT>::rows(const span& row_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  return subvec(row_span);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_col<eT>
+Col<eT>::rows(const span& row_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  return subvec(row_span);
+  }
+
+
+
+template<typename eT>
+arma_inline
+subview_col<eT>
 Col<eT>::subvec(const span& row_span)
   {
   arma_extra_debug_sigprint();
@@ -902,6 +926,24 @@
 
 template<typename eT>
 template<uword fixed_n_elem>
+template<typename fill_type>
+inline
+Col<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&)
+  : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  if(is_same_type<fill_type, fill::fill_zeros>::yes)  (*this).zeros();
+  if(is_same_type<fill_type, fill::fill_ones >::yes)  (*this).ones();
+  if(is_same_type<fill_type, fill::fill_eye  >::yes)  (*this).eye();
+  if(is_same_type<fill_type, fill::fill_randu>::yes)  (*this).randu();
+  if(is_same_type<fill_type, fill::fill_randn>::yes)  (*this).randn();
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_elem>
 template<typename T1>
 inline
 Col<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A)

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -58,7 +58,7 @@
   inline Cube(const uword in_rows, const uword in_cols, const uword in_slices);
   
   template<typename fill_type>
-  inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const arma::fill::fill_class<fill_type>& f);
+  inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const fill::fill_class<fill_type>& f);
   
   #if defined(ARMA_USE_CXX11)
   inline                  Cube(Cube&& m);
@@ -239,9 +239,6 @@
   
   inline const Cube& fill(const eT val);
   
-  template<typename fill_type>
-  arma_hot inline const Cube& fill(const arma::fill::fill_class<fill_type>& f);
-  
   inline const Cube& zeros();
   inline const Cube& zeros(const uword in_rows, const uword in_cols, const uword in_slices);
   
@@ -361,23 +358,19 @@
   
   public:
   
-  inline fixed() { mem_setup(); }
+  inline fixed();
+  inline fixed(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X);
   
-  inline const Cube& operator=(const eT val) { mem_setup(); Cube<eT>::operator=(val); return *this; }
+  template<typename fill_type>       inline fixed(const fill::fill_class<fill_type>& f);
+  template<typename T1>              inline fixed(const BaseCube<eT,T1>& A);
+  template<typename T1, typename T2> inline fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
   
-  template<typename T1>
-  inline fixed(const BaseCube<eT,T1>& A) { mem_setup(); Cube<eT>::operator=(A.get_ref()); }
-  
-  template<typename T1>
-  inline const Cube& operator=(const BaseCube<eT,T1>& A) { Cube<eT>::operator=(A.get_ref()); return *this; }
-  
-  template<typename T1, typename T2>
-  inline explicit fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B) { mem_setup(); Cube<eT>::init(A,B); }
-  
-  
+  using Cube<eT>::operator=;
   using Cube<eT>::operator();
   
+  inline const Cube& operator=(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X);
   
+  
   arma_inline arma_warn_unused       eT& operator[] (const uword i);
   arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -79,7 +79,7 @@
 template<typename eT>
 template<typename fill_type>
 inline
-Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const arma::fill::fill_class<fill_type>& f)
+Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class<fill_type>&)
   : n_rows(in_n_rows)
   , n_cols(in_n_cols)
   , n_elem_slice(in_n_rows*in_n_cols)
@@ -93,7 +93,12 @@
   
   init_cold();
   
-  (*this).fill(f);
+  if(is_same_type<fill_type, fill::fill_zeros>::yes)  (*this).zeros();
+  if(is_same_type<fill_type, fill::fill_ones >::yes)  (*this).ones();
+  if(is_same_type<fill_type, fill::fill_randu>::yes)  (*this).randu();
+  if(is_same_type<fill_type, fill::fill_randn>::yes)  (*this).randn();
+  
+  if(is_same_type<fill_type, fill::fill_eye  >::yes)  { arma_debug_check(true, "Cube::Cube(): unsupported fill type"); }
   }
 
 
@@ -2714,29 +2719,8 @@
 
 
 template<typename eT>
-template<typename fill_type>
-arma_hot
 inline
 const Cube<eT>&
-Cube<eT>::fill(const arma::fill::fill_class<fill_type>&)
-  {
-  arma_extra_debug_sigprint();
-  
-  if(is_same_type<fill_type, arma::fill::fill_zeros>::yes)  (*this).zeros();
-  if(is_same_type<fill_type, arma::fill::fill_ones >::yes)  (*this).ones();
-  if(is_same_type<fill_type, arma::fill::fill_randu>::yes)  (*this).randu();
-  if(is_same_type<fill_type, arma::fill::fill_randn>::yes)  (*this).randn();
-  
-  if(is_same_type<fill_type, arma::fill::fill_eye  >::yes)  { arma_debug_check(true, "Cube::fill(): unsupported fill type"); }
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-inline
-const Cube<eT>&
 Cube<eT>::zeros()
   {
   arma_extra_debug_sigprint();
@@ -3451,7 +3435,7 @@
   
   if(this != &x)
     {
-    if( (x.mem_state == 0) && (x.n_elem > Cube_prealloc::mem_n_elem) )
+    if( (mem_state <= 1) && (x.mem_state <= 1) && (x.n_elem > Cube_prealloc::mem_n_elem) )
       {
       reset();
       
@@ -3485,6 +3469,7 @@
       access::rw(x.n_elem_slice) = 0;
       access::rw(x.n_slices)     = 0;
       access::rw(x.n_elem)       = 0;
+      access::rw(x.mem_state)    = 0;
       access::rw(x.mem)          = 0;
       }
     else
@@ -3496,13 +3481,18 @@
 
 
 
+//
+//  Cube::fixed
+
+
+
 template<typename eT>
 template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
 arma_inline
 void
 Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::mem_setup()
   {
-  arma_extra_debug_sigprint_this(this);
+  arma_extra_debug_sigprint();
   
   if(fixed_n_elem > 0)
     {
@@ -3535,6 +3525,103 @@
 
 template<typename eT>
 template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
+inline
+Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed()
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  mem_setup();
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
+inline
+Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  mem_setup();
+  
+        eT* dest = (use_extra) ?   mem_local_extra :   mem_local;
+  const eT* src  = (use_extra) ? X.mem_local_extra : X.mem_local;
+  
+  arrayops::copy( dest, src, fixed_n_elem );
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
+template<typename fill_type>
+inline
+Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const fill::fill_class<fill_type>&)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  mem_setup();
+  
+  if(is_same_type<fill_type, fill::fill_zeros>::yes)  (*this).zeros();
+  if(is_same_type<fill_type, fill::fill_ones >::yes)  (*this).ones();
+  if(is_same_type<fill_type, fill::fill_randu>::yes)  (*this).randu();
+  if(is_same_type<fill_type, fill::fill_randn>::yes)  (*this).randn();
+  
+  if(is_same_type<fill_type, fill::fill_eye  >::yes)  { arma_debug_check(true, "Cube::fixed::fixed(): unsupported fill type"); }
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
+template<typename T1>
+inline
+Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const BaseCube<eT,T1>& A)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  mem_setup();
+  
+  Cube<eT>::operator=(A.get_ref()); 
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
+template<typename T1, typename T2>
+inline
+Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  mem_setup();
+  
+  Cube<eT>::init(A,B);
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
+inline
+const Cube<eT>&
+Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator=(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+        eT* dest = (use_extra) ?   mem_local_extra :   mem_local;
+  const eT* src  = (use_extra) ? X.mem_local_extra : X.mem_local;
+  
+  arrayops::copy( dest, src, fixed_n_elem );
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
 arma_inline
 arma_warn_unused
 eT&
@@ -3683,6 +3770,11 @@
 
 
 
+//
+// Cube_aux
+
+
+
 //! prefix ++
 template<typename eT>
 arma_inline

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -50,7 +50,7 @@
   inline Mat(const uword in_rows, const uword in_cols);
   
   template<typename fill_type>
-  inline Mat(const uword in_rows, const uword in_cols, const arma::fill::fill_class<fill_type>& f);
+  inline Mat(const uword in_rows, const uword in_cols, const fill::fill_class<fill_type>& f);
   
   inline                  Mat(const char*        text);
   inline const Mat& operator=(const char*        text);
@@ -172,9 +172,6 @@
   inline            Col<eT>  unsafe_col(const uword col_num);
   inline      const Col<eT>  unsafe_col(const uword col_num) const;
   
-  // TODO: rows( span )
-  // TODO: cols( span )
-  // TODO: also need to add the overloads in Col and Row classes
   
   arma_inline       subview<eT> rows(const uword in_row1, const uword in_row2);
   arma_inline const subview<eT> rows(const uword in_row1, const uword in_row2) const;
@@ -182,10 +179,16 @@
   arma_inline       subview<eT> cols(const uword in_col1, const uword in_col2);
   arma_inline const subview<eT> cols(const uword in_col1, const uword in_col2) const;
   
+  inline            subview<eT> rows(const span& row_span);
+  inline      const subview<eT> rows(const span& row_span) const;
+  
+  arma_inline       subview<eT> cols(const span& col_span);
+  arma_inline const subview<eT> cols(const span& col_span) const;
+  
+  
   arma_inline       subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
   arma_inline const subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
   
-  
   inline            subview<eT> submat    (const span& row_span, const span& col_span);
   inline      const subview<eT> submat    (const span& row_span, const span& col_span) const;
   
@@ -373,7 +376,7 @@
   arma_hot inline const Mat& fill(const eT val);
   
   template<typename fill_type>
-  arma_hot inline const Mat& fill(const arma::fill::fill_class<fill_type>& f);
+  arma_hot inline const Mat& fill(const fill::fill_class<fill_type>& f);
   
   inline const Mat& zeros();
   inline const Mat& zeros(const uword in_elem);
@@ -578,7 +581,7 @@
   arma_inline fixed();
   arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X);
   
-  template<typename fill_type>       inline fixed(const arma::fill::fill_class<fill_type>& f);
+  template<typename fill_type>       inline fixed(const fill::fill_class<fill_type>& f);
   template<typename T1>              inline fixed(const Base<eT,T1>& A);
   template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
   
@@ -623,9 +626,6 @@
   
   arma_inline arma_warn_unused bool is_vec() const;
   
-  template<typename fill_type>
-  arma_hot inline const Mat<eT>& fill(const arma::fill::fill_class<fill_type>& f);
-  
   arma_hot inline const Mat<eT>& fill(const eT val);
   arma_hot inline const Mat<eT>& zeros();
   arma_hot inline const Mat<eT>& ones();

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -73,7 +73,7 @@
 template<typename eT>
 template<typename fill_type>
 inline
-Mat<eT>::Mat(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class<fill_type>& f)
+Mat<eT>::Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill_class<fill_type>& f)
   : n_rows(in_n_rows)
   , n_cols(in_n_cols)
   , n_elem(in_n_rows*in_n_cols)
@@ -866,6 +866,7 @@
     const uword x_mem_state = x.mem_state;
     
     const uword t_vec_state = vec_state;
+    const uword t_mem_state = mem_state;
     
     bool layout_ok = false;
     
@@ -887,7 +888,7 @@
       }
     
     
-    if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (layout_ok == true) )
+    if( (t_mem_state <= 1) && (x_mem_state <= 1) && (x_n_elem > arma_config::mat_prealloc) && (layout_ok == true) )
       {
       reset();
       // note: calling reset() also prevents fixed size matrices from changing size or using non-local memory
@@ -897,10 +898,11 @@
       access::rw(n_elem) = x_n_elem;
       access::rw(mem)    = x.mem;
       
-      access::rw(x.n_rows) = 0;
-      access::rw(x.n_cols) = 0;
-      access::rw(x.n_elem) = 0;
-      access::rw(x.mem)    = 0;
+      access::rw(x.n_rows)    = 0;
+      access::rw(x.n_cols)    = 0;
+      access::rw(x.n_elem)    = 0;
+      access::rw(x.mem_state) = 0;
+      access::rw(x.mem)       = 0;
       }
     else
       {
@@ -2670,6 +2672,118 @@
 
 
 
+//! creation of subview (submatrix comprised of specified row vectors)
+template<typename eT>
+inline
+subview<eT>
+Mat<eT>::rows(const span& row_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  const bool row_all = row_span.whole;
+  
+  const uword local_n_rows = n_rows;
+  
+  const uword in_row1       = row_all ? 0            : row_span.a;
+  const uword in_row2       =                          row_span.b;
+  const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
+  
+  arma_debug_check
+    (
+    ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
+    ,
+    "Mat::rows(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview<eT>(*this, in_row1, 0, submat_n_rows, n_cols);
+  }
+
+
+
+//! creation of subview (submatrix comprised of specified row vectors)
+template<typename eT>
+inline
+const subview<eT>
+Mat<eT>::rows(const span& row_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const bool row_all = row_span.whole;
+  
+  const uword local_n_rows = n_rows;
+  
+  const uword in_row1       = row_all ? 0            : row_span.a;
+  const uword in_row2       =                          row_span.b;
+  const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
+  
+  arma_debug_check
+    (
+    ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
+    ,
+    "Mat::rows(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview<eT>(*this, in_row1, 0, submat_n_rows, n_cols);
+  }
+
+
+
+//! creation of subview (submatrix comprised of specified column vectors)
+template<typename eT>
+arma_inline
+subview<eT>
+Mat<eT>::cols(const span& col_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  const bool col_all = col_span.whole;
+  
+  const uword local_n_cols = n_cols;
+  
+  const uword in_col1       = col_all ? 0            : col_span.a;
+  const uword in_col2       =                          col_span.b;
+  const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
+  
+  arma_debug_check
+    (
+    ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
+    ,
+    "Mat::cols(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview<eT>(*this, 0, in_col1, n_rows, submat_n_cols);
+  }
+
+
+
+//! creation of subview (submatrix comprised of specified column vectors)
+template<typename eT>
+arma_inline
+const subview<eT>
+Mat<eT>::cols(const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const bool col_all = col_span.whole;
+  
+  const uword local_n_cols = n_cols;
+  
+  const uword in_col1       = col_all ? 0            : col_span.a;
+  const uword in_col2       =                          col_span.b;
+  const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
+  
+  arma_debug_check
+    (
+    ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
+    ,
+    "Mat::cols(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview<eT>(*this, 0, in_col1, n_rows, submat_n_cols);
+  }
+
+
+
 //! creation of subview (submatrix)
 template<typename eT>
 arma_inline
@@ -5166,15 +5280,15 @@
 arma_hot
 inline
 const Mat<eT>&
-Mat<eT>::fill(const arma::fill::fill_class<fill_type>&)
+Mat<eT>::fill(const fill::fill_class<fill_type>&)
   {
   arma_extra_debug_sigprint();
   
-  if(is_same_type<fill_type, arma::fill::fill_zeros>::yes)  (*this).zeros();
-  if(is_same_type<fill_type, arma::fill::fill_ones >::yes)  (*this).ones();
-  if(is_same_type<fill_type, arma::fill::fill_eye  >::yes)  (*this).eye();
-  if(is_same_type<fill_type, arma::fill::fill_randu>::yes)  (*this).randu();
-  if(is_same_type<fill_type, arma::fill::fill_randn>::yes)  (*this).randn();
+  if(is_same_type<fill_type, fill::fill_zeros>::yes)  (*this).zeros();
+  if(is_same_type<fill_type, fill::fill_ones >::yes)  (*this).ones();
+  if(is_same_type<fill_type, fill::fill_eye  >::yes)  (*this).eye();
+  if(is_same_type<fill_type, fill::fill_randu>::yes)  (*this).randu();
+  if(is_same_type<fill_type, fill::fill_randn>::yes)  (*this).randn();
   
   return *this;
   }
@@ -6292,12 +6406,16 @@
 template<uword fixed_n_rows, uword fixed_n_cols>
 template<typename fill_type>
 inline
-Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const arma::fill::fill_class<fill_type>& f)
+Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const fill::fill_class<fill_type>&)
   : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : mem_local) )
   {
   arma_extra_debug_sigprint_this(this);
   
-  (*this).fill(f);
+  if(is_same_type<fill_type, fill::fill_zeros>::yes)  (*this).zeros();
+  if(is_same_type<fill_type, fill::fill_ones >::yes)  (*this).ones();
+  if(is_same_type<fill_type, fill::fill_eye  >::yes)  (*this).eye();
+  if(is_same_type<fill_type, fill::fill_randu>::yes)  (*this).randu();
+  if(is_same_type<fill_type, fill::fill_randn>::yes)  (*this).randn();
   }
 
 
@@ -6686,30 +6804,9 @@
 
 template<typename eT>
 template<uword fixed_n_rows, uword fixed_n_cols>
-template<typename fill_type>
 arma_hot
 inline
 const Mat<eT>&
-Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fill(const arma::fill::fill_class<fill_type>&)
-  {
-  arma_extra_debug_sigprint();
-  
-  if(is_same_type<fill_type, arma::fill::fill_zeros>::yes)  (*this).zeros();
-  if(is_same_type<fill_type, arma::fill::fill_ones >::yes)  (*this).ones();
-  if(is_same_type<fill_type, arma::fill::fill_eye  >::yes)  (*this).eye();
-  if(is_same_type<fill_type, arma::fill::fill_randu>::yes)  (*this).randu();
-  if(is_same_type<fill_type, arma::fill::fill_randn>::yes)  (*this).randn();
-  
-  return *this;
-  }
-
-
-
-template<typename eT>
-template<uword fixed_n_rows, uword fixed_n_cols>
-arma_hot
-inline
-const Mat<eT>&
 Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fill(const eT val)
   {
   arma_extra_debug_sigprint();

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -27,8 +27,8 @@
   inline explicit Row(const uword N);
   inline          Row(const uword in_rows, const uword in_cols);
   
-  template<typename fill_type> inline Row(const uword n_elem,                       const arma::fill::fill_class<fill_type>& f);
-  template<typename fill_type> inline Row(const uword in_rows, const uword in_cols, const arma::fill::fill_class<fill_type>& f);
+  template<typename fill_type> inline Row(const uword n_elem,                       const fill::fill_class<fill_type>& f);
+  template<typename fill_type> inline Row(const uword in_rows, const uword in_cols, const fill::fill_class<fill_type>& f);
   
   inline                  Row(const char*        text);
   inline const Row& operator=(const char*        text);
@@ -77,6 +77,7 @@
   arma_inline eT  col(const uword col_num) const;
   
   using Mat<eT>::cols;
+  using Mat<eT>::operator();
   
   arma_inline       subview_row<eT> cols(const uword in_col1, const uword in_col2);
   arma_inline const subview_row<eT> cols(const uword in_col1, const uword in_col2) const;
@@ -84,11 +85,12 @@
   arma_inline       subview_row<eT> subvec(const uword in_col1, const uword in_col2);
   arma_inline const subview_row<eT> subvec(const uword in_col1, const uword in_col2) const;
   
+  arma_inline       subview_row<eT> cols(const span& col_span);
+  arma_inline const subview_row<eT> cols(const span& col_span) const;
+  
   arma_inline       subview_row<eT> subvec(const span& col_span);
   arma_inline const subview_row<eT> subvec(const span& col_span) const;
   
-  using Mat<eT>::operator();
-  
   arma_inline       subview_row<eT> operator()(const span& col_span);
   arma_inline const subview_row<eT> operator()(const span& col_span) const;
   
@@ -162,8 +164,8 @@
   arma_inline fixed();
   arma_inline fixed(const fixed<fixed_n_elem>& X);
        inline fixed(const subview_cube<eT>& X);
-  // TODO: constructor with fill
   
+  template<typename fill_type>       inline fixed(const fill::fill_class<fill_type>& f);
   template<typename T1>              inline fixed(const Base<eT,T1>& A);
   template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp	2013-09-27 19:30:44 UTC (rev 4538)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp	2013-09-28 01:45:32 UTC (rev 4539)
@@ -59,7 +59,7 @@
 template<typename eT>
 template<typename fill_type>
 inline
-Row<eT>::Row(const uword in_n_elem, const arma::fill::fill_class<fill_type>& f)
+Row<eT>::Row(const uword in_n_elem, const fill::fill_class<fill_type>& f)
   : Mat<eT>(arma_vec_indicator(), 1, in_n_elem, 2)
   {
   arma_extra_debug_sigprint();
@@ -72,7 +72,7 @@
 template<typename eT>
 template<typename fill_type>
 inline
-Row<eT>::Row(const uword in_n_rows, const uword in_n_cols, const arma::fill::fill_class<fill_type>& f)
+Row<eT>::Row(const uword in_n_rows, const uword in_n_cols, const fill::fill_class<fill_type>& f)
   : Mat<eT>(arma_vec_indicator(), 2)
   {
   arma_extra_debug_sigprint();
@@ -241,7 +241,9 @@
   arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem);
 
   for(typename SpRow<eT>::const_iterator it = X.begin(); it != X.end(); ++it)
+    {
     at(it.col()) = (*it);
+    }
   }
 
 
@@ -533,6 +535,30 @@
 template<typename eT>
 arma_inline
 subview_row<eT>
+Row<eT>::cols(const span& col_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  return subvec(col_span);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_row<eT>
+Row<eT>::cols(const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  return subvec(col_span);
+  }
+
+
+
+template<typename eT>
+arma_inline
+subview_row<eT>
 Row<eT>::subvec(const span& col_span)
   {
   arma_extra_debug_sigprint();
@@ -852,6 +878,24 @@
 
 template<typename eT>
 template<uword fixed_n_elem>
+template<typename fill_type>
+inline
+Row<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&)
+  : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  if(is_same_type<fill_type, fill::fill_zeros>::yes)  (*this).zeros();
+  if(is_same_type<fill_type, fill::fill_ones >::yes)  (*this).ones();
+  if(is_same_type<fill_type, fill::fill_eye  >::yes)  (*this).eye();
+  if(is_same_type<fill_type, fill::fill_randu>::yes)  (*this).randu();
+  if(is_same_type<fill_type, fill::fill_randn>::yes)  (*this).randn();
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_elem>
 template<typename T1>
 arma_inline
 Row<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A)

[TRUNCATED]

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


More information about the Rcpp-commits mailing list