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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 7 05:21:12 CET 2011


Author: edd
Date: 2011-01-07 05:21:11 +0100 (Fri, 07 Jan 2011)
New Revision: 2844

Added:
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_cumsum.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_elem.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trimat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_trimat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_trimat_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_proto.hpp
Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   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/Proxy.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/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/debug.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_proto.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_dot.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_mean.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_median.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_prod.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_stddev.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_sum.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_var.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/forward_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/lapack_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_find_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/podarray_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/span.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
   pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
Log:
release 0.2.11 with Armadillo 1.1.0


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/ChangeLog	2011-01-07 04:21:11 UTC (rev 2844)
@@ -1,13 +1,19 @@
+2011-01-06  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.2.11
+
+	* inst/include/*: Updated to Armadillo 1.1.0 "Climate Vandal"
+
 2010-12-12  Romain Francois <romain at r-enthusiasts.com>
 
-    * R/SHLIB.R: new unexported R function SHLIB, small wrapper around 
-    R CMD SHLIB
+	* R/SHLIB.R: new unexported R function SHLIB, small wrapper around R
+	CMD SHLIB
 
 2010-11-25  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.2.10
 
-	* inst/include/*: Update to Armadillo 1.0.0 "Antipodean Antileech”
+	* inst/include/*: Updated to Armadillo 1.0.0 "Antipodean Antileech”
 
 2010-11-19  Dirk Eddelbuettel  <edd at debian.org>
 
@@ -24,13 +30,13 @@
 
 	* DESCRIPTION: Release 0.2.9
 
-	* inst/include/*: Update to Armadillo 0.9.92 "Wall Street Gangster"
+	* inst/include/*: Updated to Armadillo 0.9.92 "Wall Street Gangster"
 
 2010-10-16  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.2.8
 
-	* inst/include/*: Update to Armadillo 0.9.90 "Water Dragon"
+	* inst/include/*: Updated to Armadillo 0.9.90 "Water Dragon"
 
 	* NEWS: moved to inst/NEWS so that it gets installed with the package
 	* inst/ChangeLog: moved to top-level enabling 'C-x 4 a' lookups

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/DESCRIPTION	2011-01-07 04:21:11 UTC (rev 2844)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.10.1
+Version: 0.2.11
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Romain Francois, Dirk Eddelbuettel and Doug Bates <RcppArmadillo-authors at r-enthusiasts.com>

Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo	2011-01-07 04:21:11 UTC (rev 2844)
@@ -147,6 +147,7 @@
   
   #include "armadillo_bits/field_proto.hpp"
   #include "armadillo_bits/subview_proto.hpp"
+  #include "armadillo_bits/subview_elem1_proto.hpp"
   #include "armadillo_bits/subview_field_proto.hpp"
   #include "armadillo_bits/subview_cube_proto.hpp"
   #include "armadillo_bits/diagview_proto.hpp"
@@ -207,6 +208,8 @@
   #include "armadillo_bits/op_find_proto.hpp"
   #include "armadillo_bits/op_chol_proto.hpp"
   #include "armadillo_bits/op_cx_scalar_proto.hpp"
+  #include "armadillo_bits/op_trimat_proto.hpp"
+  #include "armadillo_bits/op_cumsum_proto.hpp"
   
   #include "armadillo_bits/glue_times_proto.hpp"
   #include "armadillo_bits/glue_mixed_proto.hpp"
@@ -314,6 +317,7 @@
   #include "armadillo_bits/fn_zeros.hpp"
   #include "armadillo_bits/fn_ones.hpp"
   #include "armadillo_bits/fn_misc.hpp"
+  #include "armadillo_bits/fn_elem.hpp"
   #include "armadillo_bits/fn_norm.hpp"
   #include "armadillo_bits/fn_dot.hpp"
   #include "armadillo_bits/fn_randu.hpp"
@@ -350,6 +354,8 @@
   #include "armadillo_bits/fn_trunc_exp.hpp"
   #include "armadillo_bits/fn_trunc_log.hpp"
   #include "armadillo_bits/fn_toeplitz.hpp"
+  #include "armadillo_bits/fn_trimat.hpp"
+  #include "armadillo_bits/fn_cumsum.hpp"
   
   //
   // class meat
@@ -372,6 +378,7 @@
   #include "armadillo_bits/Cube_meat.hpp"
   #include "armadillo_bits/field_meat.hpp"
   #include "armadillo_bits/subview_meat.hpp"
+  #include "armadillo_bits/subview_elem1_meat.hpp"
   #include "armadillo_bits/subview_field_meat.hpp"
   #include "armadillo_bits/subview_cube_meat.hpp"
   #include "armadillo_bits/diagview_meat.hpp"
@@ -411,6 +418,8 @@
   #include "armadillo_bits/op_find_meat.hpp"
   #include "armadillo_bits/op_chol_meat.hpp"
   #include "armadillo_bits/op_cx_scalar_meat.hpp"
+  #include "armadillo_bits/op_trimat_meat.hpp"
+  #include "armadillo_bits/op_cumsum_meat.hpp"
   
   #include "armadillo_bits/glue_times_meat.hpp"
   #include "armadillo_bits/glue_mixed_meat.hpp"

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -308,6 +308,31 @@
 
 
 
+template<typename eT>
+arma_inline
+subview_col<eT>
+Col<eT>::subvec(const u32 in_row1, const u32 in_row2)
+  {
+  arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used");
+  
+  return subview_col<eT>(*this, 0, in_row1, in_row2);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_col<eT>
+Col<eT>::subvec(const u32 in_row1, const u32 in_row2)
+  const
+  {
+  arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used");
+  
+  return subview_col<eT>(*this, 0, in_row1, in_row2);
+  }
+
+
+
 //! remove specified row
 template<typename eT>
 inline

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -14,7 +14,7 @@
 //! \addtogroup Col
 //! @{
 
-//! Class for column vectors (matrices with only column)
+//! Class for column vectors (matrices with only one column)
 
 template<typename eT>
 class Col : public Mat<eT>, public BaseVec< eT, Col<eT> >
@@ -56,7 +56,10 @@
   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;
   
+  arma_inline       subview_col<eT> subvec(const u32 in_row1, const u32 in_row2);
+  arma_inline const subview_col<eT> subvec(const u32 in_row1, const u32 in_row2) const;
   
+  
   inline void shed_row (const u32 row_num);
   inline void shed_rows(const u32 in_row1, const u32 in_row2);
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -1724,6 +1724,30 @@
 
 
 
+//! linear element accessor (treats the cube as a vector); no bounds check.  
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT&
+Cube<eT>::at(const u32 i)
+  {
+  return access::rw(mem[i]);
+  }
+
+
+
+//! linear element accessor (treats the cube as a vector); no bounds check
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT
+Cube<eT>::at(const u32 i) const
+  {
+  return mem[i];
+  }
+
+
+
 //! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
 template<typename eT>
 arma_inline
@@ -2296,14 +2320,18 @@
       save_okay = diskio::save_arma_ascii(*this, name);
       break;
     
+    case raw_binary:
+      save_okay = diskio::save_raw_binary(*this, name);
+      break;
+    
     case arma_binary:
       save_okay = diskio::save_arma_binary(*this, name);
       break;
-      
+    
     case ppm_binary:
       save_okay = diskio::save_ppm_binary(*this, name);
       break;
-
+    
     default:
       arma_warn(print_status, "Cube::save(): unsupported file type");
       save_okay = false;
@@ -2336,14 +2364,18 @@
       save_okay = diskio::save_arma_ascii(*this, os);
       break;
     
+    case raw_binary:
+      save_okay = diskio::save_raw_binary(*this, os);
+      break;
+    
     case arma_binary:
       save_okay = diskio::save_arma_binary(*this, os);
       break;
-      
+    
     case ppm_binary:
       save_okay = diskio::save_ppm_binary(*this, os);
       break;
-
+    
     default:
       arma_warn(print_status, "Cube::save(): unsupported file type");
       save_okay = false;
@@ -2381,14 +2413,18 @@
       load_okay = diskio::load_arma_ascii(*this, name, err_msg);
       break;
     
+    case raw_binary:
+      load_okay = diskio::load_raw_binary(*this, name, err_msg);
+      break;
+    
     case arma_binary:
       load_okay = diskio::load_arma_binary(*this, name, err_msg);
       break;
-      
+    
     case ppm_binary:
       load_okay = diskio::load_ppm_binary(*this, name, err_msg);
       break;
-
+    
     default:
       arma_warn(print_status, "Cube::load(): unsupported file type");
       load_okay = false;
@@ -2441,10 +2477,14 @@
       load_okay = diskio::load_arma_ascii(*this, is, err_msg);
       break;
     
+    case raw_binary:
+      load_okay = diskio::load_raw_binary(*this, is, err_msg);
+      break;
+    
     case arma_binary:
       load_okay = diskio::load_arma_binary(*this, is, err_msg);
       break;
-      
+    
     case ppm_binary:
       load_okay = diskio::load_ppm_binary(*this, is, err_msg);
       break;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -156,11 +156,16 @@
   
   arma_inline arma_warn_unused eT& operator[] (const u32 i);
   arma_inline arma_warn_unused eT  operator[] (const u32 i) const;
+  
+  arma_inline arma_warn_unused eT& at(const u32 i);
+  arma_inline arma_warn_unused eT  at(const u32 i) const;
+  
   arma_inline arma_warn_unused eT& operator() (const u32 i);
   arma_inline arma_warn_unused eT  operator() (const u32 i) const;
   
   arma_inline arma_warn_unused eT& at         (const u32 in_row, const u32 in_col, const u32 in_slice);
   arma_inline arma_warn_unused eT  at         (const u32 in_row, const u32 in_col, const u32 in_slice) const;
+  
   arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32 in_col, const u32 in_slice);
   arma_inline arma_warn_unused eT  operator() (const u32 in_row, const u32 in_col, const u32 in_slice) const;
   
@@ -173,9 +178,11 @@
   arma_inline arma_warn_unused bool is_finite() const;
   arma_inline arma_warn_unused bool is_empty()  const;
   
+  // TODO: expand .in_range() to handle ranges specified by span
   arma_inline arma_warn_unused bool in_range(const u32 i) const;
   arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in_col, const u32 in_slice) const;
   
+  
   arma_inline arma_warn_unused       eT* memptr();
   arma_inline arma_warn_unused const eT* memptr() const;
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -1065,7 +1065,116 @@
 
 
 template<typename eT>
+template<typename T1>
 inline
+Mat<eT>::Mat(const subview_elem1<eT,T1>& X)
+  : n_rows(0)
+  , n_cols(0)
+  , n_elem(0)
+  , vec_state(0)
+  , mem_state(0)
+  //, mem(0)
+  , mem(mem)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  this->operator=(X);
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+inline
+const Mat<eT>&
+Mat<eT>::operator=(const subview_elem1<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  subview_elem1<eT,T1>::extract(*this, X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+inline
+const Mat<eT>&
+Mat<eT>::operator+=(const subview_elem1<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  subview_elem1<eT,T1>::plus_inplace(*this, X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+inline
+const Mat<eT>&
+Mat<eT>::operator-=(const subview_elem1<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  subview_elem1<eT,T1>::minus_inplace(*this, X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+inline
+const Mat<eT>&
+Mat<eT>::operator*=(const subview_elem1<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  glue_times::apply_inplace(*this, X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+inline
+const Mat<eT>&
+Mat<eT>::operator%=(const subview_elem1<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  subview_elem1<eT,T1>::schur_inplace(*this, X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+inline
+const Mat<eT>&
+Mat<eT>::operator/=(const subview_elem1<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  subview_elem1<eT,T1>::div_inplace(*this, X);
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+inline
 mat_injector< Mat<eT> >
 Mat<eT>::operator<<(const eT val)
   {
@@ -1092,7 +1201,7 @@
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" );
+  arma_debug_check( row_num >= n_rows, "Mat::row(): out of bounds" );
   
   return subview_row<eT>(*this, row_num);
   }
@@ -1107,13 +1216,83 @@
   {
   arma_extra_debug_sigprint();
   
-  arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" );
+  arma_debug_check( row_num >= n_rows, "Mat::row(): out of bounds" );
   
   return subview_row<eT>(*this, row_num);
   }
 
 
 
+template<typename eT>
+arma_inline
+subview_row<eT>
+Mat<eT>::operator()(const u32 row_num, const span_helper)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check( (row_num >= n_rows), "Mat::operator(): row out of bounds" );
+  
+  return subview_row<eT>(*this, row_num);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_row<eT>
+Mat<eT>::operator()(const u32 row_num, const span_helper) const
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check( (row_num >= n_rows), "Mat::operator(): row out of bounds" );
+  
+  return subview_row<eT>(*this, row_num);
+  }
+
+
+
+template<typename eT>
+arma_inline
+subview_row<eT>
+Mat<eT>::operator()(const u32 row_num, const span& col_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 a = col_span.a;
+  const u32 b = col_span.b;
+  
+  arma_debug_check
+    (
+    (row_num >= n_rows) || (a > b) || (b >= n_cols),
+    "Mat::operator(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview_row<eT>(*this, row_num, a, b);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_row<eT>
+Mat<eT>::operator()(const u32 row_num, const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 a = col_span.a;
+  const u32 b = col_span.b;
+  
+  arma_debug_check
+    (
+    (row_num >= n_rows) || (a > b) || (b >= n_cols),
+    "Mat::operator(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview_row<eT>(*this, row_num, a, b);
+  }
+
+
+
 //! creation of subview (column vector)
 template<typename eT>
 arma_inline
@@ -1144,6 +1323,76 @@
 
 
 
+template<typename eT>
+arma_inline
+subview_col<eT>
+Mat<eT>::operator()(const span_helper, const u32 col_num)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check( col_num >= n_cols, "Mat::operator(): column out of bounds");
+  
+  return subview_col<eT>(*this, col_num);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_col<eT>
+Mat<eT>::operator()(const span_helper, const u32 col_num) const
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check( col_num >= n_cols, "Mat::operator(): column out of bounds");
+  
+  return subview_col<eT>(*this, col_num);
+  }
+
+
+
+template<typename eT>
+arma_inline
+subview_col<eT>
+Mat<eT>::operator()(const span& row_span, const u32 col_num)
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 a = row_span.a;
+  const u32 b = row_span.b;
+  
+  arma_debug_check
+    (
+    (col_num >= n_cols) || (a > b) || (b >= n_rows),
+    "Mat::operator(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview_col<eT>(*this, col_num, a, b);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview_col<eT>
+Mat<eT>::operator()(const span& row_span, const u32 col_num) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 a = row_span.a;
+  const u32 b = row_span.b;
+  
+  arma_debug_check
+    (
+    (col_num >= n_cols) || (a > b) || (b >= n_rows),
+    "Mat::operator(): indices out of bounds or incorrectly used"
+    );
+  
+  return subview_col<eT>(*this, col_num, a, b);
+  }
+
+
+
 //! create a Col object which uses memory from an existing matrix object.
 //! this approach is currently not alias safe
 //! and does not take into account that the parent matrix object could be deleted.
@@ -1346,6 +1595,82 @@
 
 
 
+template<typename eT>
+arma_inline
+subview<eT>
+Mat<eT>::operator()(const span& row_span, const span& col_span)
+  {
+  arma_extra_debug_sigprint();
+  
+  return submat(row_span, col_span);
+  }
+
+
+
+template<typename eT>
+arma_inline
+const subview<eT>
+Mat<eT>::operator()(const span& row_span, const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  return submat(row_span, col_span);
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+arma_inline
+subview_elem1<eT,T1>
+Mat<eT>::elem(const Base<u32,T1>& a)
+  {
+  arma_extra_debug_sigprint();
+  
+  return subview_elem1<eT,T1>(*this, a);
+  }
+
+
+
+template<typename eT>
+template<typename T1>
+arma_inline
+const subview_elem1<eT,T1>
+Mat<eT>::elem(const Base<u32,T1>& a) const
+  {
+  arma_extra_debug_sigprint();
+  
+  return subview_elem1<eT,T1>(*this, a);
+  }
+
+
+
+// template<typename eT>
+// template<typename T1, typename T2>
+// arma_inline
+// subview_elem2<eT,T1,T2>
+// Mat<eT>::elem(const Base<u32,T1>& a, const Base<u32,T2>& b)
+//   {
+//   arma_extra_debug_sigprint();
+//   
+//   return subview_elem2<eT,T1,T2>(*this, a, b);
+//   }
+// 
+// 
+// 
+// template<typename eT>
+// template<typename T1, typename T2>
+// arma_inline
+// const subview_elem2<eT,T1,T2>
+// Mat<eT>::elem(const Base<u32,T1>& a, const Base<u32,T2>& b) const
+//   {
+//   arma_extra_debug_sigprint();
+//   
+//   return subview_elem2<eT,T1,T2>(*this, a, b);
+//   }
+
+
+
 //! creation of diagview (diagonal)
 template<typename eT>
 arma_inline
@@ -2564,6 +2889,30 @@
 
 
 
+//! linear element accessor (treats the matrix as a vector); no bounds check.  
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT&
+Mat<eT>::at(const u32 i)
+  {
+  return access::rw(mem[i]);
+  }
+
+
+
+//! linear element accessor (treats the matrix as a vector); no bounds check
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT
+Mat<eT>::at(const u32 i) const
+  {
+  return mem[i];
+  }
+
+
+
 //! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
 template<typename eT>
 arma_inline
@@ -2744,6 +3093,23 @@
 
 
 
+//! returns true if the given start and end indices are currently in range
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::in_range(const span& x) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 a = x.a;
+  const u32 b = x.b;
+  
+  return ( (a <= b) && (b < n_elem) );
+  }
+
+
+
 //! returns true if the given location is currently in range
 template<typename eT>
 arma_inline
@@ -2756,6 +3122,89 @@
 
 
 
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::in_range(const span& row_span, const u32 in_col) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 in_row1 = row_span.a;
+  const u32 in_row2 = row_span.b;
+  
+  return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) );
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::in_range(const span& row_span, const span_helper) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 in_row1 = row_span.a;
+  const u32 in_row2 = row_span.b;
+  
+  return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (n_cols > 0) );
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::in_range(const u32 in_row, const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 in_col1 = col_span.a;
+  const u32 in_col2 = col_span.b;
+  
+  return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) );
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::in_range(const span_helper, const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 in_col1 = col_span.a;
+  const u32 in_col2 = col_span.b;
+  
+  return ( (n_rows > 0) && (in_col1 <= in_col2) && (in_col2 < n_cols) );
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::in_range(const span& row_span, const span& col_span) const
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 in_row1 = row_span.a;
+  const u32 in_row2 = row_span.b;
+  
+  const u32 in_col1 = col_span.a;
+  const u32 in_col2 = col_span.b;
+  
+  return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) );
+  }
+
+
+
 //! returns a pointer to array of eTs for a specified column; no bounds check
 template<typename eT>
 arma_inline
@@ -3339,6 +3788,10 @@
       save_okay = diskio::save_arma_ascii(*this, name);
       break;
     
+    case raw_binary:
+      save_okay = diskio::save_raw_binary(*this, name);
+      break;
+    
     case arma_binary:
       save_okay = diskio::save_arma_binary(*this, name);
       break;
@@ -3379,6 +3832,10 @@
       save_okay = diskio::save_arma_ascii(*this, os);
       break;
     
+    case raw_binary:
+      save_okay = diskio::save_raw_binary(*this, os);
+      break;
+    
     case arma_binary:
       save_okay = diskio::save_arma_binary(*this, os);
       break;
@@ -3424,6 +3881,10 @@
       load_okay = diskio::load_arma_ascii(*this, name, err_msg);
       break;
     
+    case raw_binary:
+      load_okay = diskio::load_raw_binary(*this, name, err_msg);
+      break;
+    
     case arma_binary:
       load_okay = diskio::load_arma_binary(*this, name, err_msg);
       break;
@@ -3484,6 +3945,10 @@
       load_okay = diskio::load_arma_ascii(*this, is, err_msg);
       break;
     
+    case raw_binary:
+      load_okay = diskio::load_raw_binary(*this, is, err_msg);
+      break;
+    
     case arma_binary:
       load_okay = diskio::load_arma_binary(*this, is, err_msg);
       break;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -99,7 +99,6 @@
   inline const Mat& operator%=(const subview_cube<eT>& X);
   inline const Mat& operator/=(const subview_cube<eT>& X);
 
-  
   //inline explicit          Mat(const diagview<eT>& X);
   inline                   Mat(const diagview<eT>& X);
   inline const Mat&  operator=(const diagview<eT>& X);
@@ -109,7 +108,15 @@
   inline const Mat& operator%=(const diagview<eT>& X);
   inline const Mat& operator/=(const diagview<eT>& X);
   
+  template<typename T1> inline                   Mat(const subview_elem1<eT,T1>& X);
+  template<typename T1> inline const Mat& operator= (const subview_elem1<eT,T1>& X);
+  template<typename T1> inline const Mat& operator+=(const subview_elem1<eT,T1>& X);
+  template<typename T1> inline const Mat& operator-=(const subview_elem1<eT,T1>& X);
+  template<typename T1> inline const Mat& operator*=(const subview_elem1<eT,T1>& X);
+  template<typename T1> inline const Mat& operator%=(const subview_elem1<eT,T1>& X);
+  template<typename T1> inline const Mat& operator/=(const subview_elem1<eT,T1>& X);
   
+  
   inline mat_injector<Mat> operator<<(const eT val);
   inline mat_injector<Mat> operator<<(const injector_helper x);
   
@@ -117,12 +124,26 @@
   arma_inline       subview_row<eT> row(const u32 row_num);
   arma_inline const subview_row<eT> row(const u32 row_num) const;
   
+  arma_inline       subview_row<eT> operator()(const u32 row_num, const span_helper);
+  arma_inline const subview_row<eT> operator()(const u32 row_num, const span_helper) const;
+  
+  arma_inline       subview_row<eT> operator()(const u32 row_num, const span& col_span);
+  arma_inline const subview_row<eT> operator()(const u32 row_num, const span& col_span) const;
+  
+  
   arma_inline       subview_col<eT> col(const u32 col_num);
   arma_inline const subview_col<eT> col(const u32 col_num) const;
   
+  arma_inline       subview_col<eT> operator()(const span_helper,    const u32 col_num);
+  arma_inline const subview_col<eT> operator()(const span_helper,    const u32 col_num) const;
+  
+  arma_inline       subview_col<eT> operator()(const span& row_span, const u32 col_num);
+  arma_inline const subview_col<eT> operator()(const span& row_span, const u32 col_num) const;
+  
   inline            Col<eT>  unsafe_col(const u32 col_num);
   inline      const Col<eT>  unsafe_col(const u32 col_num) const;
   
+  
   arma_inline       subview<eT> rows(const u32 in_row1, const u32 in_row2);
   arma_inline const subview<eT> rows(const u32 in_row1, const u32 in_row2) const;
   
@@ -132,9 +153,21 @@
   arma_inline       subview<eT> submat(const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2);
   arma_inline const subview<eT> submat(const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2) const;
   
-  arma_inline       subview<eT> submat(const span& row_span, const span& col_span);
-  arma_inline const subview<eT> submat(const span& row_span, const span& col_span) const;
   
+  arma_inline       subview<eT> submat    (const span& row_span, const span& col_span);
+  arma_inline const subview<eT> submat    (const span& row_span, const span& col_span) const;
+  
+  arma_inline       subview<eT> operator()(const span& row_span, const span& col_span);
+  arma_inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
+  
+  
+  template<typename T1> arma_inline       subview_elem1<eT,T1> elem(const Base<u32,T1>& a);
+  template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const Base<u32,T1>& a) const;
+  
+  // template<typename T1, typename T2> arma_inline       subview_elem2<eT,T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b);
+  // template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b) const;
+  
+  
   arma_inline       diagview<eT> diag(const s32 in_id = 0);
   arma_inline const diagview<eT> diag(const s32 in_id = 0) const;
   
@@ -206,8 +239,11 @@
   template<typename T1, typename T2, typename glue_type> inline const Mat& operator%=(const mtGlue<eT, T1, T2, glue_type>& X);
   template<typename T1, typename T2, typename glue_type> inline const Mat& operator/=(const mtGlue<eT, T1, T2, glue_type>& X);
   
+  
   arma_inline arma_warn_unused eT& operator[] (const u32 i);
   arma_inline arma_warn_unused eT  operator[] (const u32 i) const;
+  arma_inline arma_warn_unused eT& at         (const u32 i);
+  arma_inline arma_warn_unused eT  at         (const u32 i) const;
   arma_inline arma_warn_unused eT& operator() (const u32 i);
   arma_inline arma_warn_unused eT  operator() (const u32 i) const;
   
@@ -227,9 +263,17 @@
   arma_inline arma_warn_unused bool is_square() const;
        inline arma_warn_unused bool is_finite() const;
   
-  arma_inline arma_warn_unused bool in_range(const u32 i) const;
-  arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in_col) const;
+  // TODO: test and add expanded .in_range() to user documentation
+  arma_inline arma_warn_unused bool in_range(const u32   i) const;
+  arma_inline arma_warn_unused bool in_range(const span& x) const;
   
+  arma_inline arma_warn_unused bool in_range(const u32         in_row,   const u32         in_col  ) const;
+  arma_inline arma_warn_unused bool in_range(const span&       row_span, const u32         in_col  ) const;
+  arma_inline arma_warn_unused bool in_range(const span&       row_span, const span_helper junk    ) const;
+  arma_inline arma_warn_unused bool in_range(const u32         in_row,   const span&       col_span) const;
+  arma_inline arma_warn_unused bool in_range(const span_helper junk,     const span&       col_span) const;
+  arma_inline arma_warn_unused bool in_range(const span&       row_span, const span&       col_span) const;
+  
   arma_inline arma_warn_unused       eT* colptr(const u32 in_col);
   arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const;
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp	2011-01-06 21:29:08 UTC (rev 2843)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp	2011-01-07 04:21:11 UTC (rev 2844)
@@ -56,7 +56,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q.memptr(); }
+  arma_inline ea_type get_ea()                   const { return Q.memptr(); }
+  arma_inline bool    is_alias(const Mat<eT>& X) const { return (&Q == &X); }
   };
 
 
@@ -86,7 +87,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q.memptr(); }
+  arma_inline ea_type get_ea()                   const { return Q.memptr(); }
+  arma_inline bool    is_alias(const Mat<eT>& X) const { return (&Q == &X); }
   };
 
 
@@ -116,7 +118,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q.memptr(); }
+  arma_inline ea_type get_ea()                   const { return Q.memptr(); }
+  arma_inline bool    is_alias(const Mat<eT>& X) const { return (&Q == &X); }
   };
 
 
@@ -146,7 +149,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q.memptr(); }
+  arma_inline ea_type get_ea()                        const { return Q.memptr(); }
+  arma_inline bool    is_alias(const Mat<elem_type>&) const { return false;      }
   };
 
 
@@ -176,7 +180,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q.memptr(); }
+  arma_inline ea_type get_ea()                        const { return Q.memptr(); }
+  arma_inline bool    is_alias(const Mat<elem_type>&) const { return false;      }
   };
 
 
@@ -206,12 +211,43 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q; }
+  arma_inline ea_type get_ea()                   const { return Q;              }
+  arma_inline bool    is_alias(const Mat<eT>& X) const { return (&(Q.m) == &X); }
   };
 
 
 
+template<typename eT, typename T1>
+class Proxy< subview_elem1<eT,T1> >
+  {
+  public:
+  
+  typedef eT                                       elem_type;
+  typedef typename get_pod_type<elem_type>::result pod_type;
+  typedef Mat<eT>                                  stored_type;
+  typedef const eT*                                ea_type;
+  
+  arma_aligned const Mat<eT> Q;
+  
+  inline explicit Proxy(const subview_elem1<eT,T1>& A)
+    : Q(A)
+    {
+    arma_extra_debug_sigprint();
+    }
+  
+  arma_inline u32 get_n_rows() const { return Q.n_rows; }
+  arma_inline u32 get_n_cols() const { return Q.n_cols; }
+  arma_inline u32 get_n_elem() const { return Q.n_elem; }
+  
+  arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
+  arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
+  
+  arma_inline ea_type get_ea()                 const { return Q.memptr(); }
+  arma_inline bool    is_alias(const Mat<eT>&) const { return false;      }
+  };
 
+
+
 template<typename eT>
 class Proxy< diagview<eT> >
   {
@@ -237,7 +273,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
   arma_inline elem_type at         (const u32 row, const u32 col) const { return Q.at(row, col); }
   
-  arma_inline ea_type get_ea() const { return Q; }
+  arma_inline ea_type get_ea()                   const { return Q;              }
+  arma_inline bool    is_alias(const Mat<eT>& X) const { return (&(Q.m) == &X); }
   };
 
 
@@ -268,7 +305,8 @@
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
[TRUNCATED]

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


More information about the Rcpp-commits mailing list