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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 24 05:48:47 CEST 2013


Author: edd
Date: 2013-09-24 05:48:46 +0200 (Tue, 24 Sep 2013)
New Revision: 4534

Added:
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft2.hpp
Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/include/armadillo
   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_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_config.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/debug.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_elem.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_fft.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/mul_herk.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_resize_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/span.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_cube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp
Log:
Upgraded to Armadillo pre-release of 3.920.0 to test sparse matrix ctor


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/ChangeLog	2013-09-24 03:48:46 UTC (rev 4534)
@@ -1,3 +1,8 @@
+2013-09-23  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/*: Upgraded to Armadillo pre-release of 3.920.0
+	* DESCRIPTION: Mark as test release version 0.3.910.0.2
+
 2013-09-15  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/RcppArmadilloAs.h: Also define ConstInputParameter

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/DESCRIPTION	2013-09-24 03:48:46 UTC (rev 4534)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.910.0.1
+Version: 0.3.910.0.2
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Dirk Eddelbuettel <edd at debian.org>

Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo	2013-09-24 03:48:46 UTC (rev 4534)
@@ -422,6 +422,7 @@
   #include "armadillo_bits/fn_histc.hpp"
   #include "armadillo_bits/fn_unique.hpp"
   #include "armadillo_bits/fn_fft.hpp"
+  #include "armadillo_bits/fn_fft2.hpp"
   #include "armadillo_bits/fn_any.hpp"
   #include "armadillo_bits/fn_all.hpp"
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -27,6 +27,9 @@
   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);
+  
   inline                  Col(const char*        text);
   inline const Col& operator=(const char*        text);
   
@@ -39,12 +42,16 @@
   #if defined(ARMA_USE_CXX11)
   inline                  Col(const std::initializer_list<eT>& list);
   inline const Col& operator=(const std::initializer_list<eT>& list);
+  
+  inline                  Col(Col&& m);
+  inline const Col& operator=(Col&& m);
   #endif
   
   inline explicit Col(const SpCol<eT>& X);
   
   inline const Col& operator=(const eT val);
-    
+  inline const Col& operator=(const Col& m);
+  
   template<typename T1> inline                   Col(const Base<eT,T1>& X);
   template<typename T1> inline const Col&  operator=(const Base<eT,T1>& X);
   
@@ -66,9 +73,11 @@
   arma_inline const Op<Col<eT>,op_htrans> ht() const;
   arma_inline const Op<Col<eT>,op_strans> st() const;
   
-  arma_inline eT& row(const uword row_num);
+  arma_inline eT& row(const uword row_num);         // TODO: inconsistent; should return a subview_row; change API for 4.0 ?
   arma_inline eT  row(const uword row_num) const;
   
+  using Mat<eT>::rows;
+  
   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;
   
@@ -156,6 +165,8 @@
   arma_inline fixed(const fixed<fixed_n_elem>& X);
        inline fixed(const subview_cube<eT>& X);
   
+  // TODO: constructor with fill_type
+  
   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);
   
@@ -178,6 +189,8 @@
     inline const Col& operator=(const std::initializer_list<eT>& list);
   #endif
   
+  arma_inline const Col& operator=(const fixed<fixed_n_elem>& X);
+  
   arma_inline const Op< Col_fixed_type, op_htrans >  t() const;
   arma_inline const Op< Col_fixed_type, op_htrans > ht() const;
   arma_inline const Op< Col_fixed_type, op_strans > st() const;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -56,6 +56,34 @@
 
 
 
+template<typename eT>
+template<typename fill_type>
+inline
+Col<eT>::Col(const uword in_n_elem, const arma::fill::fill_class<fill_type>& f)
+  : Mat<eT>(arma_vec_indicator(), in_n_elem, 1, 1)
+  {
+  arma_extra_debug_sigprint();
+  
+  (*this).fill(f);
+  }
+
+
+
+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)
+  : Mat<eT>(arma_vec_indicator(), 0, 0, 1)
+  {
+  arma_extra_debug_sigprint();
+  
+  Mat<eT>::init_warm(in_n_rows, in_n_cols);
+  
+  (*this).fill(f);
+  }
+
+
+
 //! construct a column vector from specified text
 template<typename eT>
 inline
@@ -207,6 +235,32 @@
     return *this;
     }
   
+  
+  
+  template<typename eT>
+  inline
+  Col<eT>::Col(Col<eT>&& X)
+    : Mat<eT>(arma_vec_indicator(), 1)
+    {
+    arma_extra_debug_sigprint();
+    
+    (*this).steal_mem(X);
+    }
+  
+  
+  
+  template<typename eT>
+  inline
+  const Col<eT>&
+  Col<eT>::operator=(Col<eT>&& X)
+    {
+    arma_extra_debug_sigprint();
+    
+    (*this).steal_mem(X);
+    
+    return *this;
+    }
+  
 #endif
 
 
@@ -221,7 +275,9 @@
   arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem);
 
   for(typename SpCol<eT>::const_iterator it = X.begin(); it != X.end(); ++it)
+    {
     at(it.row()) = (*it);
+    }
   }
 
 
@@ -241,6 +297,20 @@
 
 
 template<typename eT>
+inline
+const Col<eT>&
+Col<eT>::operator=(const Col<eT>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  Mat<eT>::operator=(X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
 template<typename T1>
 inline
 Col<eT>::Col(const Base<eT,T1>& X)
@@ -809,9 +879,10 @@
   {
   arma_extra_debug_sigprint_this(this);
   
-  eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
+        eT* dest = (use_extra) ?   mem_local_extra : Mat<eT>::mem_local;
+  const eT* src  = (use_extra) ? X.mem_local_extra :        X.mem_local;
   
-  arrayops::copy( dest, X.mem, fixed_n_elem );
+  arrayops::copy( dest, src, fixed_n_elem );
   }
 
 
@@ -1026,6 +1097,24 @@
 template<typename eT>
 template<uword fixed_n_elem>
 arma_inline
+const Col<eT>&
+Col<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+        eT* dest = (use_extra) ?   mem_local_extra : Mat<eT>::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_elem>
+arma_inline
 const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, op_htrans >
 Col<eT>::fixed<fixed_n_elem>::t() const
   {

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -57,6 +57,14 @@
   
   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);
+  
+  #if defined(ARMA_USE_CXX11)
+  inline                  Cube(Cube&& m);
+  inline const Cube& operator=(Cube&& m);
+  #endif
+  
   inline Cube(      eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool strict = true);
   inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices);
   
@@ -98,7 +106,16 @@
   inline            subview_cube<eT> operator()(const span& row_span, const span& col_span, const span& slice_span);
   inline      const subview_cube<eT> operator()(const span& row_span, const span& col_span, const span& slice_span) const;
   
+  arma_inline       subview_cube<eT> tube(const uword in_row1, const uword in_col1);
+  arma_inline const subview_cube<eT> tube(const uword in_row1, const uword in_col1) const;
   
+  arma_inline       subview_cube<eT> tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
+  arma_inline const subview_cube<eT> tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
+  
+  inline            subview_cube<eT> tube(const span& row_span, const span& col_span);
+  inline      const subview_cube<eT> tube(const span& row_span, const span& col_span) const;
+  
+  
   inline void shed_slice(const uword slice_num);
   
   inline void shed_slices(const uword in_slice1, const uword in_slice2);
@@ -222,6 +239,9 @@
   
   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);
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -75,8 +75,69 @@
 
 
 
+//! construct the cube to have user specified dimensions and fill with specified pattern
 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)
+  : n_rows(in_n_rows)
+  , n_cols(in_n_cols)
+  , n_elem_slice(in_n_rows*in_n_cols)
+  , n_slices(in_n_slices)
+  , n_elem(in_n_rows*in_n_cols*in_n_slices)
+  , mem_state(0)
+  , mat_ptrs()
+  , mem()
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  init_cold();
+  
+  (*this).fill(f);
+  }
+
+
+
+#if defined(ARMA_USE_CXX11)
+  
+  template<typename eT>
+  inline
+  Cube<eT>::Cube(Cube<eT>&& in_cube)
+    : n_rows(0)
+    , n_cols(0)
+    , n_elem_slice(0)
+    , n_slices(0)
+    , n_elem(0)
+    , mem_state(0)
+    , mat_ptrs()
+    , mem()
+    {
+    arma_extra_debug_sigprint_this(this);
+    arma_extra_debug_sigprint(arma_boost::format("this = %x   in_cube = %x") % this % &in_cube);
+    
+    (*this).steal_mem(in_cube);
+    }
+    
+  
+  
+  template<typename eT>
+  inline
+  const Cube<eT>&
+  Cube<eT>::operator=(Cube<eT>&& in_cube)
+    {
+    arma_extra_debug_sigprint(arma_boost::format("this = %x   in_cube = %x") % this % &in_cube);
+    
+    (*this).steal_mem(in_cube);
+    
+    return *this;
+    }
+  
+#endif
+
+
+
+template<typename eT>
+inline
 void
 Cube<eT>::init_cold()
   {
@@ -970,6 +1031,156 @@
 
 
 
+template<typename eT>
+arma_inline
+subview_cube<eT>
+Cube<eT>::tube(const uword in_row1, const uword in_col1)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check
+    (
+    ((in_row1 >= n_rows) || (in_col1 >= n_cols)),
+    "Cube::tube(): indices out of bounds"
+    );
+  
+  return subview_cube<eT>(*this, in_row1, in_col1, 0, 1, 1, n_slices);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_cube<eT>
+Cube<eT>::tube(const uword in_row1, const uword in_col1) const
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check
+    (
+    ((in_row1 >= n_rows) || (in_col1 >= n_cols)),
+    "Cube::tube(): indices out of bounds"
+    );
+  
+  return subview_cube<eT>(*this, in_row1, in_col1, 0, 1, 1, n_slices);
+  }
+
+
+
+template<typename eT>
+arma_inline
+subview_cube<eT>
+Cube<eT>::tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check
+    (
+    (in_row1 >  in_row2) || (in_col1 >  in_col2) ||
+    (in_row2 >= n_rows)  || (in_col2 >= n_cols),
+    "Cube::tube(): indices out of bounds or incorrectly used"
+    );
+  
+  const uword subcube_n_rows = in_row2 - in_row1 + 1;
+  const uword subcube_n_cols = in_col2 - in_col1 + 1;
+  
+  return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_cube<eT>
+Cube<eT>::tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check
+    (
+    (in_row1 >  in_row2) || (in_col1 >  in_col2) ||
+    (in_row2 >= n_rows)  || (in_col2 >= n_cols),
+    "Cube::tube(): indices out of bounds or incorrectly used"
+    );
+  
+  const uword subcube_n_rows = in_row2 - in_row1 + 1;
+  const uword subcube_n_cols = in_col2 - in_col1 + 1;
+  
+  return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices);
+  }
+
+
+
+template<typename eT>
+inline
+subview_cube<eT>
+Cube<eT>::tube(const span& row_span, const span& col_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  const bool row_all = row_span.whole;
+  const bool col_all = col_span.whole;
+  
+  const uword local_n_rows   = n_rows;
+  const uword local_n_cols   = n_cols;
+  
+  const uword in_row1        = row_all   ? 0            : row_span.a;
+  const uword in_row2        =                            row_span.b;
+  const uword subcube_n_rows = row_all   ? local_n_rows : in_row2 - in_row1 + 1;
+  
+  const uword in_col1        = col_all   ? 0            : col_span.a;
+  const uword in_col2        =                            col_span.b;
+  const uword subcube_n_cols = col_all   ? local_n_cols : in_col2 - in_col1 + 1;
+  
+  arma_debug_check
+    (
+    ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
+    ||
+    ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
+    ,
+    "Cube::tube(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices);
+  }
+
+
+
+template<typename eT>
+inline
+const subview_cube<eT>
+Cube<eT>::tube(const span& row_span, const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const bool row_all = row_span.whole;
+  const bool col_all = col_span.whole;
+  
+  const uword local_n_rows   = n_rows;
+  const uword local_n_cols   = n_cols;
+  
+  const uword in_row1        = row_all   ? 0            : row_span.a;
+  const uword in_row2        =                            row_span.b;
+  const uword subcube_n_rows = row_all   ? local_n_rows : in_row2 - in_row1 + 1;
+  
+  const uword in_col1        = col_all   ? 0            : col_span.a;
+  const uword in_col2        =                            col_span.b;
+  const uword subcube_n_cols = col_all   ? local_n_cols : in_col2 - in_col1 + 1;
+  
+  arma_debug_check
+    (
+    ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
+    ||
+    ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
+    ,
+    "Cube::tube(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices);
+  }
+
+
+
 //! remove specified slice
 template<typename eT>
 inline
@@ -2503,13 +2714,36 @@
 
 
 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();
   
-  return (*this).fill(eT(0));
+  arrayops::fill_zeros(memptr(), n_elem);
+  
+  return *this;
   }
 
 
@@ -2523,7 +2757,7 @@
   
   set_size(in_rows, in_cols, in_slices);
   
-  return (*this).fill(eT(0));
+  return (*this).zeros();
   }
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -49,6 +49,9 @@
   
   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 char*        text);
   inline const Mat& operator=(const char*        text);
   
@@ -61,6 +64,9 @@
   #if defined(ARMA_USE_CXX11)
   inline                  Mat(const std::initializer_list<eT>& list);
   inline const Mat& operator=(const std::initializer_list<eT>& list);
+  
+  inline                  Mat(Mat&& m);
+  inline const Mat& operator=(Mat&& m);
   #endif
   
   inline Mat(      eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem = true, const bool strict = true);
@@ -166,6 +172,9 @@
   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;
@@ -363,6 +372,9 @@
   
   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);
+  
   inline const Mat& zeros();
   inline const Mat& zeros(const uword in_elem);
   inline const Mat& zeros(const uword in_rows, const uword in_cols);
@@ -566,6 +578,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 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);
   
@@ -582,6 +595,8 @@
     inline const Mat& operator=(const std::initializer_list<eT>& list);
   #endif
   
+  arma_inline const Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>& X);
+  
   arma_inline const Op< Mat_fixed_type, op_htrans >  t() const;
   arma_inline const Op< Mat_fixed_type, op_htrans > ht() const;
   arma_inline const Op< Mat_fixed_type, op_strans > st() const;
@@ -608,6 +623,9 @@
   
   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-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -69,6 +69,27 @@
 
 
 
+//! construct the matrix to have user specified dimensions and fill with specified pattern
+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)
+  : n_rows(in_n_rows)
+  , n_cols(in_n_cols)
+  , n_elem(in_n_rows*in_n_cols)
+  , vec_state(0)
+  , mem_state(0)
+  , mem()
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  init_cold();
+  
+  (*this).fill(f);
+  }
+
+
+
 //! constructor used by Row and Col classes
 template<typename eT>
 inline
@@ -509,6 +530,38 @@
     return *this;
     }
   
+  
+  
+  template<typename eT>
+  inline
+  Mat<eT>::Mat(Mat<eT>&& in_mat)
+    : n_rows(0)
+    , n_cols(0)
+    , n_elem(0)
+    , vec_state(0)
+    , mem_state(0)
+    , mem()
+    {
+    arma_extra_debug_sigprint_this(this);
+    arma_extra_debug_sigprint(arma_boost::format("this = %x   in_mat = %x") % this % &in_mat);
+    
+    (*this).steal_mem(in_mat);
+    }
+  
+  
+  
+  template<typename eT>
+  inline
+  const Mat<eT>&
+  Mat<eT>::operator=(Mat<eT>&& in_mat)
+    {
+    arma_extra_debug_sigprint(arma_boost::format("this = %x   in_mat = %x") % this % &in_mat);
+    
+    (*this).steal_mem(in_mat);
+    
+    return *this;
+    }
+  
 #endif
   
 
@@ -5107,14 +5160,37 @@
 
 
 
+//! fill the matrix with the specified value
 template<typename eT>
+template<typename fill_type>
+arma_hot
 inline
 const Mat<eT>&
+Mat<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_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>
+inline
+const Mat<eT>&
 Mat<eT>::zeros()
   {
   arma_extra_debug_sigprint();
   
-  return fill(eT(0));
+  arrayops::fill_zeros(memptr(), n_elem);
+  
+  return *this;
   }
 
 
@@ -5128,7 +5204,7 @@
   
   set_size(in_elem);
   
-  return fill(eT(0));
+  return (*this).zeros();
   }
 
 
@@ -5136,13 +5212,13 @@
 template<typename eT>
 inline
 const Mat<eT>&
-Mat<eT>::zeros(const uword in_rows, const uword in_cols)
+Mat<eT>::zeros(const uword in_n_rows, const uword in_n_cols)
   {
   arma_extra_debug_sigprint();
-
-  set_size(in_rows, in_cols);
   
-  return fill(eT(0));
+  set_size(in_n_rows, in_n_cols);
+  
+  return (*this).zeros();
   }
 
 
@@ -5278,7 +5354,7 @@
   {
   arma_extra_debug_sigprint();
   
-  fill(eT(0));
+  (*this).zeros();
   
   const uword N = (std::min)(n_rows, n_cols);
   
@@ -6204,15 +6280,30 @@
   {
   arma_extra_debug_sigprint_this(this);
   
-  eT* dest = (use_extra) ? mem_local_extra : mem_local;
+        eT* dest = (use_extra) ?   mem_local_extra :   mem_local;
+  const eT* src  = (use_extra) ? X.mem_local_extra : X.mem_local;
   
-  arrayops::copy( dest, X.mem, fixed_n_elem );
+  arrayops::copy( dest, src, fixed_n_elem );
   }
 
 
 
 template<typename eT>
 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>( 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);
+  }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols>
 template<typename T1>
 inline
 Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const Base<eT,T1>& A)
@@ -6323,6 +6414,24 @@
 template<typename eT>
 template<uword fixed_n_rows, uword fixed_n_cols>
 arma_inline
+const Mat<eT>&
+Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const fixed<fixed_n_rows, fixed_n_cols>& 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>
+arma_inline
 const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::Mat_fixed_type, op_htrans >
 Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::t() const
   {
@@ -6577,9 +6686,30 @@
 
 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-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -27,6 +27,9 @@
   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);
+  
   inline                  Row(const char*        text);
   inline const Row& operator=(const char*        text);
   
@@ -39,11 +42,15 @@
   #if defined(ARMA_USE_CXX11)
   inline                  Row(const std::initializer_list<eT>& list);
   inline const Row& operator=(const std::initializer_list<eT>& list);
+  
+  inline                  Row(Row&& m);
+  inline const Row& operator=(Row&& m);
   #endif
   
   inline explicit Row(const SpRow<eT>& X);
   
   inline const Row& operator=(const eT val);
+  inline const Row& operator=(const Row& X);
   
   template<typename T1> inline                   Row(const Base<eT,T1>& X);
   template<typename T1> inline const Row&  operator=(const Base<eT,T1>& X);
@@ -66,9 +73,11 @@
   arma_inline const Op<Row<eT>,op_htrans> ht() const;
   arma_inline const Op<Row<eT>,op_strans> st() const;
   
-  arma_inline eT& col(const uword col_num);
+  arma_inline eT& col(const uword col_num);         // TODO: inconsistent; should return a subview_col; change API for 4.0 ?
   arma_inline eT  col(const uword col_num) const;
   
+  using Mat<eT>::cols;
+  
   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;
   
@@ -153,6 +162,7 @@
   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 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);
@@ -176,6 +186,8 @@
     inline const Row& operator=(const std::initializer_list<eT>& list);
   #endif
   
+  arma_inline const Row& operator=(const fixed<fixed_n_elem>& X);
+    
   arma_inline const Op< Row_fixed_type, op_htrans >  t() const;
   arma_inline const Op< Row_fixed_type, op_htrans > ht() const;
   arma_inline const Op< Row_fixed_type, op_strans > st() const;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -57,7 +57,35 @@
 
 
 template<typename eT>
+template<typename fill_type>
 inline
+Row<eT>::Row(const uword in_n_elem, const arma::fill::fill_class<fill_type>& f)
+  : Mat<eT>(arma_vec_indicator(), 1, in_n_elem, 2)
+  {
+  arma_extra_debug_sigprint();
+  
+  (*this).fill(f);
+  }
+
+
+
+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)
+  : Mat<eT>(arma_vec_indicator(), 2)
+  {
+  arma_extra_debug_sigprint();
+  
+  Mat<eT>::init_warm(in_n_rows, in_n_cols);
+  
+  (*this).fill(f);
+  }
+
+
+
+template<typename eT>
+inline
 Row<eT>::Row(const char* text)
   {
   arma_extra_debug_sigprint();
@@ -173,6 +201,32 @@
     return *this;
     }
   
+  
+  
+  template<typename eT>
+  inline
+  Row<eT>::Row(Row<eT>&& X)
+    : Mat<eT>(arma_vec_indicator(), 2)
+    {
+    arma_extra_debug_sigprint();
+    
+    (*this).steal_mem(X);
+    }
+  
+  
+  
+  template<typename eT>
+  inline
+  const Row<eT>&
+  Row<eT>::operator=(Row<eT>&& X)
+    {
+    arma_extra_debug_sigprint();
+    
+    (*this).steal_mem(X);
+    
+    return *this;
+    }
+  
 #endif
 
 
@@ -207,6 +261,20 @@
 
 
 template<typename eT>
+inline
+const Row<eT>&
+Row<eT>::operator=(const Row<eT>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  Mat<eT>::operator=(X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
 template<typename T1>
 inline
 Row<eT>::Row(const Base<eT,T1>& X)
@@ -761,9 +829,10 @@
   {
   arma_extra_debug_sigprint_this(this);
   
-  eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
+        eT* dest = (use_extra) ?   mem_local_extra : Mat<eT>::mem_local;
+  const eT* src  = (use_extra) ? X.mem_local_extra :        X.mem_local;
   
-  arrayops::copy( dest, X.mem, fixed_n_elem );
+  arrayops::copy( dest, src, fixed_n_elem );
   }
 
 
@@ -964,6 +1033,24 @@
 template<typename eT>
 template<uword fixed_n_elem>
 arma_inline
+const Row<eT>&
+Row<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+        eT* dest = (use_extra) ?   mem_local_extra : Mat<eT>::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_elem>
+arma_inline
 const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, op_htrans >
 Row<eT>::fixed<fixed_n_elem>::t() const
   {

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp	2013-09-23 02:53:46 UTC (rev 4533)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp	2013-09-24 03:48:46 UTC (rev 4534)
@@ -36,21 +36,27 @@
    * The memory used to store the values of the matrix.
    * In accordance with the CSC format, this stores only the actual values.
    * The correct locations of the values are assembled from the row indices
-   * and the column pointers.
+   * and the column pointers.  The length of this array is n_nonzero + 1; the
+   * final value ensures the integrity of iterators.  If you are planning on
+   * resizing this vector, it's probably best to use mem_resize() instead.
    */
   const eT* const values;
   
   /**
    * The row indices of each value.  row_indices[i] is the row of values[i].
    * The length of this array is n_nonzero + 1; the final value ensures the
-   * integrity of iterators.
+   * integrity of iterators.  If you are planning on resizing this vector, it's
+   * probably best to use mem_resize() instead.
    */
   const uword* const row_indices;
   
   /**
    * The column pointers.  This stores the index of the first item in column i.
    * That is, values[col_ptrs[i]] is the first value in column i, and it is in
-   * row row_indices[col_ptrs[i]].
+   * row row_indices[col_ptrs[i]].  This array is of length (n_cols + 2); the
+   * element col_ptrs[n_cols] should be equal to n_nonzero, and the element
+   * col_ptrs[n_cols + 1] is an invalid very large value that ensures the
+   * integrity of iterators.
    */
   const uword* const col_ptrs;
   
@@ -68,6 +74,8 @@
   template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& locations, const Base<eT,T2>& values, const bool sort_locations = true);
   template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& locations, const Base<eT,T2>& values, const uword n_rows, const uword n_cols, const bool sort_locations = true);
   
+  template<typename T1, typename T2, typename T3> inline SpMat(const Base<uword,T1>& rowind, const Base<uword,T2>& colptr, const Base<eT,T3>& values, const uword n_rows, const uword n_cols);
+  
   inline const SpMat&  operator=(const eT val); //! Sets size to 1x1.
   inline const SpMat& operator*=(const eT val);
   inline const SpMat& operator/=(const eT val);

[TRUNCATED]

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


More information about the Rcpp-commits mailing list