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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 21 16:34:12 CEST 2010


Author: edd
Date: 2010-09-21 16:34:11 +0200 (Tue, 21 Sep 2010)
New Revision: 2138

Added:
   pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/mtOpCube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/mtOpCube_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/typedef_fixed.hpp
Removed:
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_cube_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_cube_core_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_cube_misc.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_misc.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_proto.hpp
Modified:
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/NEWS
   pkg/RcppArmadillo/inst/ChangeLog
   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/OpCube_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Op_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.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/arrayops_proto.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/blas_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/debug.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diagmat_proxy.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diagview_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diagview_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eOpCube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eOpCube_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_accu.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_join.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_ones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randn.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randu.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_sort_index.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trig.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trunc_exp.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trunc_log.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_zeros.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/forward_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_relational_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_relational_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/lapack_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/mtGlue_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/mtOp_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_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_misc_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_misc_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_relational_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_relational_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_div.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_minus.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_plus.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_relational.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_schur.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_cube_times.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/typedef.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
Log:
RcppArmadillo 0.2.7 with Armadillo 0.9.80 -- but currently fails R CMD check


Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/DESCRIPTION	2010-09-21 14:34:11 UTC (rev 2138)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.6
+Version: 0.2.7
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Romain, Dirk and Doug <RcppArmadillo-authors at r-enthusiasts.com>

Modified: pkg/RcppArmadillo/NEWS
===================================================================
--- pkg/RcppArmadillo/NEWS	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/NEWS	2010-09-21 14:34:11 UTC (rev 2138)
@@ -1,3 +1,11 @@
+0.2.7   TBD
+
+    o   Upgraded to Armadillo 0.9.80 "Chihuahua Muncher":
+
+         * Added join_slices(), insert_slices(), shed_slices()
+         * Added in-place operations on diagonals
+         * Various speedups due to internal architecture improvements
+
 0.2.6   2010-09-12
 
     o   Upgraded to Armadillo 0.9.70 "Subtropical Winter Safari"

Modified: pkg/RcppArmadillo/inst/ChangeLog
===================================================================
--- pkg/RcppArmadillo/inst/ChangeLog	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/inst/ChangeLog	2010-09-21 14:34:11 UTC (rev 2138)
@@ -1,3 +1,7 @@
+2010-09-21  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/*: Update to Armadillo 0.9.80 "Chihuahua Muncher"
+
 2010-09-12  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.2.5
@@ -4,7 +8,7 @@
 
 2010-09-10   Romain Francois <romain at r-enthusiasts.com>
 
-	* inst/include/* : update to armadillo 0.9.70
+	* inst/include/* : Update to Armadillo 0.9.70 "Subtropical Winter Safari"
 
 2010-08-18   Romain Francois <romain at r-enthusiasts.com>
 

Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/inst/include/armadillo	2010-09-21 14:34:11 UTC (rev 2138)
@@ -145,6 +145,8 @@
   #include "armadillo_bits/Row_proto.hpp"
   #include "armadillo_bits/Cube_proto.hpp"
   
+  #include "armadillo_bits/typedef_fixed.hpp"
+  
   #include "armadillo_bits/field_proto.hpp"
   #include "armadillo_bits/subview_proto.hpp"
   #include "armadillo_bits/subview_field_proto.hpp"
@@ -164,6 +166,7 @@
   #include "armadillo_bits/eOpCube_proto.hpp"
   
   #include "armadillo_bits/mtOp_proto.hpp"
+  #include "armadillo_bits/mtOpCube_proto.hpp"
   
   #include "armadillo_bits/Glue_proto.hpp"
   #include "armadillo_bits/eGlue_proto.hpp"
@@ -171,12 +174,10 @@
   
   #include "armadillo_bits/GlueCube_proto.hpp"
   #include "armadillo_bits/eGlueCube_proto.hpp"
+  #include "armadillo_bits/mtGlueCube_proto.hpp"
   
   #include "armadillo_bits/eop_core_proto.hpp"
-  #include "armadillo_bits/eop_cube_core_proto.hpp"
-  
   #include "armadillo_bits/eglue_core_proto.hpp"
-  #include "armadillo_bits/eglue_cube_core_proto.hpp"
   
   #include "armadillo_bits/op_diagmat_proto.hpp"
   #include "armadillo_bits/op_diagvec_proto.hpp"
@@ -248,6 +249,7 @@
   #include "armadillo_bits/OpCube_meat.hpp"
   
   #include "armadillo_bits/mtOp_meat.hpp"
+  #include "armadillo_bits/mtOpCube_meat.hpp"
   
   #include "armadillo_bits/Glue_meat.hpp"
   #include "armadillo_bits/GlueCube_meat.hpp"
@@ -261,11 +263,9 @@
   #include "armadillo_bits/eGlueCube_meat.hpp"
 
   #include "armadillo_bits/mtGlue_meat.hpp"
+  #include "armadillo_bits/mtGlueCube_meat.hpp"
   
-  #include "armadillo_bits/eglue_misc.hpp"
-  #include "armadillo_bits/eglue_cube_misc.hpp"
   
-  
   //
   // ostream
   
@@ -361,10 +361,7 @@
   #include "armadillo_bits/gemm_mixed.hpp"
   
   #include "armadillo_bits/eop_core_meat.hpp"
-  #include "armadillo_bits/eop_cube_core_meat.hpp"
-  
   #include "armadillo_bits/eglue_core_meat.hpp"
-  #include "armadillo_bits/eglue_cube_core_meat.hpp"
   
   #include "armadillo_bits/podarray_meat.hpp"
   #include "armadillo_bits/auxlib_meat.hpp"

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2010-09-21 14:34:11 UTC (rev 2138)
@@ -311,8 +311,120 @@
 
 
 
+//! remove specified row
 template<typename eT>
 inline
+void
+Col<eT>::shed_row(const u32 row_num)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check( row_num >= Mat<eT>::n_rows, "Col::shed_row(): out of bounds");
+  
+  shed_rows(row_num, row_num);
+  }
+
+
+
+//! remove specified rows
+template<typename eT>
+inline
+void
+Col<eT>::shed_rows(const u32 in_row1, const u32 in_row2)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check
+    (
+    (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows),
+    "Col::shed_rows(): indices out of bounds or incorrectly used"
+    );
+  
+  const u32 n_keep_front = in_row1;
+  const u32 n_keep_back  = Mat<eT>::n_rows - (in_row2 + 1);
+  
+  Col<eT> X(n_keep_front + n_keep_back);
+  
+        eT* X_mem = X.memptr();
+  const eT* t_mem = (*this).memptr();
+  
+  if(n_keep_front > 0)
+    {
+    syslib::copy_elem( X_mem, t_mem, n_keep_front );
+    }
+  
+  if(n_keep_back > 0)
+    {
+    syslib::copy_elem( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_back);
+    }
+  
+  steal_mem(X);
+  }
+
+
+
+//! insert N rows at the specified row position,
+//! optionally setting the elements of the inserted rows to zero
+template<typename eT>
+inline
+void
+Col<eT>::insert_rows(const u32 row_num, const u32 N, const bool set_to_zero)
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 t_n_rows = Mat<eT>::n_rows;
+  
+  const u32 A_n_rows = row_num;
+  const u32 B_n_rows = t_n_rows - row_num;
+  
+  // insertion at row_num == n_rows is in effect an append operation
+  arma_debug_check( (row_num > t_n_rows), "Col::insert_rows(): out of bounds");
+  
+  if(N > 0)
+    {
+    Col<eT> out(t_n_rows + N);
+    
+          eT* out_mem = out.memptr();
+    const eT*   t_mem = (*this).memptr();
+    
+    if(A_n_rows > 0)
+      {
+      syslib::copy_elem( out_mem, t_mem, A_n_rows );
+      }
+    
+    if(B_n_rows > 0)
+      {
+      syslib::copy_elem( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows );
+      }
+    
+    if(set_to_zero == true)
+      {
+      arrayops::inplace_set( &(out_mem[row_num]), eT(0), N );
+      }
+    
+    steal_mem(out);
+    }
+  }
+
+
+
+//! insert the given object at the specified row position; 
+//! the given object must have one column
+template<typename eT>
+template<typename T1>
+inline
+void
+Col<eT>::insert_rows(const u32 row_num, const Base<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  Mat<eT>::insert_rows(row_num, X);
+  }
+
+
+
+template<typename eT>
+inline
 typename Col<eT>::row_iterator
 Col<eT>::begin_row(const u32 row_num)
   {

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp	2010-09-21 14:34:11 UTC (rev 2138)
@@ -60,6 +60,13 @@
   arma_inline const subview_col<eT> rows(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);
+  
+                        inline void insert_rows(const u32 row_num, const u32 N, const bool set_to_zero = true);
+  template<typename T1> inline void insert_rows(const u32 row_num, const Base<eT,T1>& X);
+  
+  
   typedef       eT*       row_iterator;
   typedef const eT* const_row_iterator;
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2010-09-21 14:34:11 UTC (rev 2138)
@@ -191,37 +191,96 @@
   const BaseCube<typename Cube<eT>::pod_type,T2>& B
   )
   {
+  arma_extra_debug_sigprint();
+  
+  typedef typename T1::elem_type          T;
+  typedef typename ProxyCube<T1>::ea_type ea_type1;
+  typedef typename ProxyCube<T2>::ea_type ea_type2;
+  
   arma_type_check< is_complex<eT>::value == false >::apply();   //!< compile-time abort if eT isn't std::complex
+  arma_type_check< is_complex< T>::value == true  >::apply();   //!< compile-time abort if T is std::complex
   
-  typedef typename T1::elem_type T;
-  arma_type_check< is_complex<T>::value == true >::apply();   //!< compile-time abort if T is std::complex
-  
   isnt_same_type<std::complex<T>, eT>::check();   //!< compile-time abort if types are not compatible
   
-  const unwrap_cube<T1> tmp_A(A.get_ref());
-  const unwrap_cube<T2> tmp_B(B.get_ref());
+  const ProxyCube<T1> X(A.get_ref());
+  const ProxyCube<T2> Y(B.get_ref());
   
-  const Cube<T>& X = tmp_A.M;
-  const Cube<T>& Y = tmp_B.M;
-  
   arma_assert_same_size(X, Y, "Cube()");
   
-  init(X.n_rows, X.n_cols, X.n_slices);
+  init(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
   
-  const T* X_mem = X.mem;
-  const T* Y_mem = Y.mem;
+  const u32      N       = n_elem;
+        eT*      out_mem = memptr();
+        ea_type1 PX      = X.get_ea();
+        ea_type2 PY      = Y.get_ea();
   
-  for(u32 i=0; i<n_elem; ++i)
+  for(u32 i=0; i<N; ++i)
     {
-    access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]);
+    out_mem[i] = std::complex<T>(PX[i], PY[i]);
     }
   }
 
 
 
+//! try to steal the memory from a given cube; 
+//! if memory can't be stolen, copy the given cube
 template<typename eT>
 inline
 void
+Cube<eT>::steal_mem(Cube<eT>& x)
+  {
+  arma_extra_debug_sigprint();
+  
+  if(this != &x)
+    {
+    if( (x.mem_state == 0) && (x.n_elem > Cube_prealloc::mem_n_elem) )
+      {
+      reset();
+      
+      const u32 x_n_slices = x.n_slices;
+      
+      access::rw(n_rows)       = x.n_rows;
+      access::rw(n_cols)       = x.n_cols;
+      access::rw(n_elem_slice) = x.n_elem_slice;
+      access::rw(n_slices)     = x_n_slices;
+      access::rw(n_elem)       = x.n_elem;
+      access::rw(mem)          = x.mem;
+      
+      if(x_n_slices > Cube_prealloc::mat_ptrs_size)
+        {
+        access::rw(  mat_ptrs) = x.mat_ptrs;
+        access::rw(x.mat_ptrs) = 0;
+        }
+      else
+        {
+        access::rw(mat_ptrs) = const_cast< const Mat<eT>** >(mat_ptrs_local);
+        
+        for(u32 i=0; i < x_n_slices; ++i)
+          {
+            mat_ptrs[i] = x.mat_ptrs[i];
+          x.mat_ptrs[i] = 0;
+          }
+        }
+      
+      access::rw(x.n_rows)       = 0;
+      access::rw(x.n_cols)       = 0;
+      access::rw(x.n_elem_slice) = 0;
+      access::rw(x.n_slices)     = 0;
+      access::rw(x.n_elem)       = 0;
+      access::rw(x.mem)          = 0;
+      }
+    else
+      {
+      init(x);
+      }
+    }
+  }
+
+
+
+template<typename eT>
+inline
+void
 Cube<eT>::delete_mat()
   {
   arma_extra_debug_sigprint();
@@ -816,6 +875,153 @@
 
 
 
+//! remove specified slice
+template<typename eT>
+inline
+void
+Cube<eT>::shed_slice(const u32 slice_num)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check( slice_num >= n_slices, "Cube::shed_slice(): out of bounds");
+  
+  shed_slices(slice_num, slice_num);
+  }
+
+
+
+//! remove specified slices
+template<typename eT>
+inline
+void
+Cube<eT>::shed_slices(const u32 in_slice1, const u32 in_slice2)
+  {
+  arma_extra_debug_sigprint();
+  
+  arma_debug_check
+    (
+    (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
+    "Cube::shed_slices(): indices out of bounds or incorrectly used"
+    );
+  
+  const u32 n_keep_front = in_slice1;
+  const u32 n_keep_back  = n_slices - (in_slice2 + 1);
+  
+  Cube<eT> X(n_rows, n_cols, n_keep_front + n_keep_back);
+  
+  if(n_keep_front > 0)
+    {
+    X.slices( 0, (n_keep_front-1) ) = slices( 0, (in_slice1-1) );
+    }
+  
+  if(n_keep_back > 0)
+    {
+    X.slices( n_keep_front,  (n_keep_front+n_keep_back-1) ) = slices( (in_slice2+1), (n_slices-1) );
+    }
+  
+  steal_mem(X);
+  }
+
+
+
+//! insert N slices at the specified slice position,
+//! optionally setting the elements of the inserted slices to zero
+template<typename eT>
+inline
+void
+Cube<eT>::insert_slices(const u32 slice_num, const u32 N, const bool set_to_zero)
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 t_n_slices = n_slices;
+  
+  const u32 A_n_slices = slice_num;
+  const u32 B_n_slices = t_n_slices - slice_num;
+  
+  // insertion at slice_num == n_slices is in effect an append operation
+  arma_debug_check( (slice_num > t_n_slices), "Cube::insert_slices(): out of bounds");
+  
+  if(N > 0)
+    {
+    Cube<eT> out(n_rows, n_cols, t_n_slices + N);
+    
+    if(A_n_slices > 0)
+      {
+      out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1);
+      }
+    
+    if(B_n_slices > 0)
+      {
+      out.slices(slice_num + N, t_n_slices + N - 1) = slices(slice_num, t_n_slices-1);
+      }
+    
+    if(set_to_zero == true)
+      {
+      //out.slices(slice_num, slice_num + N - 1).zeros();
+      
+      for(u32 i=slice_num; i < (slice_num + N); ++i)
+        {
+        out.slice(i).zeros();
+        }
+      }
+    
+    steal_mem(out);
+    }
+  }
+
+
+
+//! insert the given object at the specified slice position; 
+//! the given object must have the same number of rows and columns as the cube
+template<typename eT>
+template<typename T1>
+inline
+void
+Cube<eT>::insert_slices(const u32 slice_num, const BaseCube<eT,T1>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const unwrap_cube<T1> tmp(X.get_ref());
+  const Cube<eT>& C   = tmp.M;
+  
+  const u32 N = C.n_slices;
+  
+  const u32 t_n_slices = n_slices;
+  
+  const u32 A_n_slices = slice_num;
+  const u32 B_n_slices = t_n_slices - slice_num;
+  
+  // insertion at row_num == n_rows is in effect an append operation
+  arma_debug_check( (slice_num  >  t_n_slices), "Cube::insert_rows(): out of bounds");
+  
+  arma_debug_check
+    (
+    ( (C.n_rows != n_rows) || (C.n_cols != n_cols) ),
+    "Cube::insert_slices(): given object has an incompatible dimensions"
+    );
+  
+  if(N > 0)
+    {
+    Cube<eT> out(n_rows, n_cols, t_n_slices + N);
+    
+    if(A_n_slices > 0)
+      {
+      out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1);
+      }
+    
+    if(B_n_slices > 0)
+      {
+      out.slices(slice_num + N, t_n_slices + N - 1) = slices(slice_num, t_n_slices - 1);
+      }
+    
+    out.slices(slice_num, slice_num + N - 1) = C;
+    
+    steal_mem(out);
+    }
+  }
+
+
+
 //! create a cube from OpCube, i.e. run the previously delayed unary operations
 template<typename eT>
 template<typename T1, typename op_type>
@@ -1042,6 +1248,107 @@
 
 
 
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename op_type>
+inline
+Cube<eT>::Cube(const mtOpCube<eT, T1, op_type>& X)
+  : n_rows(0)
+  , n_cols(0)
+  , n_elem_slice(0)
+  , n_slices(0)
+  , n_elem(0)
+  , mem_state(0)
+  , mat_ptrs(mat_ptrs)
+  , mem(mem)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  op_type::apply(*this, X);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename op_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator=(const mtOpCube<eT, T1, op_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  op_type::apply(*this, X);
+  
+  return *this;
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename op_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator+=(const mtOpCube<eT, T1, op_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator+=(m);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename op_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator-=(const mtOpCube<eT, T1, op_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator-=(m);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename op_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator%=(const mtOpCube<eT, T1, op_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator%=(m);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename op_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator/=(const mtOpCube<eT, T1, op_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator/=(m);
+  }
+
+
+
 //! create a cube from Glue, i.e. run the previously delayed binary operations
 template<typename eT>
 template<typename T1, typename T2, typename glue_type>
@@ -1270,6 +1577,107 @@
 
 
 
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename T2, typename glue_type>
+inline
+Cube<eT>::Cube(const mtGlueCube<eT, T1, T2, glue_type>& X)
+  : n_rows(0)
+  , n_cols(0)
+  , n_elem_slice(0)
+  , n_slices(0)
+  , n_elem(0)
+  , mem_state(0)
+  , mat_ptrs(mat_ptrs)
+  , mem(mem)
+  {
+  arma_extra_debug_sigprint_this(this);
+  
+  glue_type::apply(*this, X);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename T2, typename glue_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator=(const mtGlueCube<eT, T1, T2, glue_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  glue_type::apply(*this, X);
+  
+  return *this;
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename T2, typename glue_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator+=(m);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename T2, typename glue_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator-=(m);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename T2, typename glue_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator%=(m);
+  }
+
+
+
+//! EXPERIMENTAL
+template<typename eT>
+template<typename T1, typename T2, typename glue_type>
+inline
+const Cube<eT>&
+Cube<eT>::operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X)
+  {
+  arma_extra_debug_sigprint();
+  
+  const Cube<eT> m(X);
+  
+  return (*this).operator/=(m);
+  }
+
+
+
 //! linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
 template<typename eT>
 arma_inline
@@ -1667,70 +2075,156 @@
 //! fill the cube with the specified value
 template<typename eT>
 inline
-void
+const Cube<eT>&
 Cube<eT>::fill(const eT val)
   {
   arma_extra_debug_sigprint();
   
   arrayops::inplace_set( memptr(), val, n_elem );
+  
+  return *this;
   }
 
 
 
 template<typename eT>
 inline
-void
+const Cube<eT>&
 Cube<eT>::zeros()
   {
   arma_extra_debug_sigprint();
   
-  fill(eT(0));
+  return (*this).fill(eT(0));
   }
 
 
 
 template<typename eT>
 inline
-void
+const Cube<eT>&
 Cube<eT>::zeros(const u32 in_rows, const u32 in_cols, const u32 in_slices)
   {
-  arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );
+  arma_extra_debug_sigprint();
   
   set_size(in_rows, in_cols, in_slices);
   
-  fill(eT(0));
+  return (*this).fill(eT(0));
   }
 
 
 
 template<typename eT>
 inline
-void
+const Cube<eT>&
 Cube<eT>::ones()
   {
   arma_extra_debug_sigprint();
   
-  fill(eT(1));
+  return (*this).fill(eT(1));
   }
 
 
 
 template<typename eT>
 inline
-void
+const Cube<eT>&
 Cube<eT>::ones(const u32 in_rows, const u32 in_cols, const u32 in_slices)
   {
-  arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );
+  arma_extra_debug_sigprint();
   
   set_size(in_rows, in_cols, in_slices);
   
-  fill(eT(1));
+  return (*this).fill(eT(1));
   }
 
 
 
 template<typename eT>
 inline
+const Cube<eT>&
+Cube<eT>::randu()
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 N   = n_elem;
+        eT* ptr = memptr();
+  
+  u32 i,j;
+  
+  for(i=0, j=1; j<N; i+=2, j+=2)
+    {
+    ptr[i] = eT(eop_aux_randu<eT>());
+    ptr[j] = eT(eop_aux_randu<eT>());
+    }
+  
+  if(i < N)
+    {
+    ptr[i] = eT(eop_aux_randu<eT>());
+    }
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+inline
+const Cube<eT>&
+Cube<eT>::randu(const u32 in_rows, const u32 in_cols, const u32 in_slices)
+  {
+  arma_extra_debug_sigprint();
+  
+  set_size(in_rows, in_cols, in_slices);
+  
+  return (*this).randu();
+  }
+
+
+
+template<typename eT>
+inline
+const Cube<eT>&
+Cube<eT>::randn()
+  {
+  arma_extra_debug_sigprint();
+  
+  const u32 N   = n_elem;
+        eT* ptr = memptr();
+  
+  u32 i,j;
+  
+  for(i=0, j=1; j<N; i+=2, j+=2)
+    {
+    ptr[i] = eT(eop_aux_randn<eT>());
+    ptr[j] = eT(eop_aux_randn<eT>());
+    }
+  
+  if(i < N)
+    {
+    ptr[i] = eT(eop_aux_randn<eT>());
+    }
+  
+  return *this;
+  }
+
+
+
+template<typename eT>
+inline
+const Cube<eT>&
+Cube<eT>::randn(const u32 in_rows, const u32 in_cols, const u32 in_slices)
+  {
+  arma_extra_debug_sigprint();
+  
+  set_size(in_rows, in_cols, in_slices);
+  
+  return (*this).randn();
+  }
+
+
+
+template<typename eT>
+inline
 void
 Cube<eT>::reset()
   {
@@ -2311,10 +2805,10 @@
 Cube_aux::set_real(Cube<eT>& out, const BaseCube<eT,T1>& X)
   {
   arma_extra_debug_sigprint();
-
+  
   const unwrap_cube<T1> tmp(X.get_ref());
   const Cube<eT>& A   = tmp.M;
-
+  
   arma_debug_assert_same_size( out, A, "Cube::set_real()" );
   
   out = A;
@@ -2322,18 +2816,6 @@
 
 
 
-template<typename T, typename T1>
-inline
-void
-Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  (is_Cube<T1>::value == true) ? Cube_aux::set_real_via_unwrap(out, X) : Cube_aux::set_real_via_proxy(out, X);
-  }
-
-
-
 template<typename eT, typename T1>
 inline
 void
@@ -2347,38 +2829,30 @@
 template<typename T, typename T1>
 inline
 void
-Cube_aux::set_imag(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
+Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
   {
   arma_extra_debug_sigprint();
   
-  (is_Cube<T1>::value == true) ? Cube_aux::set_imag_via_unwrap(out, X) : Cube_aux::set_imag_via_proxy(out, X);
-  }
-
-
-
-template<typename T, typename T1>
-inline
-void
-Cube_aux::set_real_via_unwrap(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
-  {
-  arma_extra_debug_sigprint();
+  typedef typename std::complex<T>        eT;
+  typedef typename ProxyCube<T1>::ea_type ea_type;
   
-  typedef typename std::complex<T> eT;
+  const ProxyCube<T1> A(X.get_ref());
   
-  const unwrap_cube<T1> tmp(X.get_ref());
-  const Cube<T>& A    = tmp.M;
+  arma_debug_assert_same_size
+    (
+    out.n_rows, out.n_cols, out.n_slices,
+    A.get_n_rows(), A.get_n_cols(), A.get_n_slices(),
+    "Cube::set_real()"
+    );
   
-  arma_debug_assert_same_size( out, A, "Cube::set_real()" );
+  const u32     n_elem  = out.n_elem;
+        eT*     out_mem = out.memptr();
+        ea_type PA      = A.get_ea();
   
-  const u32 n_elem = out.n_elem;
-  
-  const  T* A_mem   = A.memptr();
-        eT* out_mem = out.memptr();
-  
   for(u32 i=0; i<n_elem; ++i)
     {
-    //out_mem[i].real() = A_mem[i];
-    out_mem[i] = std::complex<T>( A_mem[i], out_mem[i].imag() );
+    //out_mem[i].real() = PA[i];
+    out_mem[i] = std::complex<T>( PA[i], out_mem[i].imag() );
     }
   }
 
@@ -2387,81 +2861,35 @@
 template<typename T, typename T1>
 inline
 void
-Cube_aux::set_imag_via_unwrap(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
+Cube_aux::set_imag(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
   {
   arma_extra_debug_sigprint();
   
-  typedef typename std::complex<T> eT;
+  typedef typename std::complex<T>        eT;
+  typedef typename ProxyCube<T1>::ea_type ea_type;
   
-  const unwrap_cube<T1> tmp(X.get_ref());
-  const Cube<T>& A    = tmp.M;
+  const ProxyCube<T1> A(X.get_ref());
   
-  arma_debug_assert_same_size( out, A, "Cube::set_imag()" );
+  arma_debug_assert_same_size
+    (
+    out.n_rows, out.n_cols, out.n_slices,
+    A.get_n_rows(), A.get_n_cols(), A.get_n_slices(),
+    "Cube::set_imag()"
+    );
   
-  const u32 n_elem = out.n_elem;
+  const u32     n_elem  = out.n_elem;
+        eT*     out_mem = out.memptr();
+        ea_type PA      = A.get_ea();
   
-  const  T* A_mem   = A.memptr();
-        eT* out_mem = out.memptr();
-  
   for(u32 i=0; i<n_elem; ++i)
     {
-    // out_mem[i].imag() = A_mem[i];
-    out_mem[i] = std::complex<T>(out_mem[i].real(), A_mem[i]);
+    //out_mem[i].imag() = PA[i];
+    out_mem[i] = std::complex<T>( out_mem[i].real(), PA[i] );
     }
   }
 
 
 
-template<typename T, typename T1>
-inline
-void
-Cube_aux::set_real_via_proxy(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  typedef typename std::complex<T> eT;
-  
-  const ProxyCube<T1> P(X.get_ref());
-  
-  arma_debug_assert_same_size( out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "Cube::set_real()" );
-  
-  const u32 n_elem  = out.n_elem;
-        eT* out_mem = out.memptr();
-  
-  for(u32 i=0; i<n_elem; ++i)
-    {
-    //out_mem[i].real() = P[i];
-    out_mem[i] = std::complex<T>( P[i], out_mem[i].imag() );
-    }
-  }
-
-
-
-template<typename T, typename T1>
-inline
-void
-Cube_aux::set_imag_via_proxy(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
-  {
-  arma_extra_debug_sigprint();
-  
-  typedef typename std::complex<T> eT;
-  
-  const ProxyCube<T1> P(X.get_ref());
-  
-  arma_debug_assert_same_size( out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "Cube::set_imag()" );
-  
-  const u32 n_elem  = out.n_elem;
-        eT* out_mem = out.memptr();
-  
-  for(u32 i=0; i<n_elem; ++i)
-    {
-    //out_mem[i].imag() = P[i];
-    out_mem[i] = std::complex<T>( out_mem[i].real(), P[i] );
-    }
-  }
-
-
-
 #ifdef ARMA_EXTRA_CUBE_MEAT
   #include ARMA_INCFILE_WRAP(ARMA_EXTRA_CUBE_MEAT)
 #endif

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp	2010-09-19 21:51:26 UTC (rev 2137)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp	2010-09-21 14:34:11 UTC (rev 2138)
@@ -43,13 +43,13 @@
   const u32  n_slices;     //!< number of slices in the cube (read-only)
   const u32  n_elem;       //!< number of elements in the cube (read-only)
   const u32  mem_state;
-
+  
   // mem_state = 0: normal cube that can be resized; 
   // mem_state = 1: use auxiliary memory until change in the number of elements is requested;  
   // mem_state = 2: use auxiliary memory and don't allow the number of elements to be changed; 
-  // mem_state = 3: fixed size via template based size specification.
-
+  // mem_state = 3: fixed size (e.g. via template based size specification).
   
+  
   arma_aligned const Mat<eT>** const mat_ptrs; //!< pointer to an array containing pointers to Mat instances (one for each slice)
   arma_aligned const eT*       const mem;      //!< pointer to the memory used by the cube (memory is read-only)
   
@@ -80,17 +80,17 @@
   inline const Cube& operator-=(const Cube& m);
   inline const Cube& operator%=(const Cube& m);
   inline const Cube& operator/=(const Cube& m);
-
+  
   template<typename T1, typename T2>
   inline explicit Cube(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
-
+  
   inline                   Cube(const subview_cube<eT>& X);
   inline const Cube&  operator=(const subview_cube<eT>& X);
   inline const Cube& operator+=(const subview_cube<eT>& X);
   inline const Cube& operator-=(const subview_cube<eT>& X);
   inline const Cube& operator%=(const subview_cube<eT>& X);
   inline const Cube& operator/=(const subview_cube<eT>& X);
-
+  
   arma_inline       Mat<eT>& slice(const u32 in_slice);
   arma_inline const Mat<eT>& slice(const u32 in_slice) const;
   
@@ -103,6 +103,17 @@
   arma_inline       subview_cube<eT> subcube(const span& row_span, const span& col_span, const span& slice_span);
   arma_inline const subview_cube<eT> subcube(const span& row_span, const span& col_span, const span& slice_span) const;
   
+  
+  inline void shed_slice(const u32 slice_num);
+  
+  inline void shed_slices(const u32 in_slice1, const u32 in_slice2);
+  
+  inline void insert_slices(const u32 slice_num, const u32 N, const bool set_to_zero = true);
+  
+  template<typename T1>
+  inline void insert_slices(const u32 row_num, const BaseCube<eT,T1>& X);
+  
+  
   template<typename T1, typename op_type> inline                   Cube(const OpCube<T1, op_type>& X);
   template<typename T1, typename op_type> inline const Cube&  operator=(const OpCube<T1, op_type>& X);
   template<typename T1, typename op_type> inline const Cube& operator+=(const OpCube<T1, op_type>& X);
@@ -117,6 +128,13 @@
   template<typename T1, typename eop_type> inline const Cube& operator%=(const eOpCube<T1, eop_type>& X);
   template<typename T1, typename eop_type> inline const Cube& operator/=(const eOpCube<T1, eop_type>& X);
   
+  template<typename T1, typename op_type> inline                   Cube(const mtOpCube<eT, T1, op_type>& X);
+  template<typename T1, typename op_type> inline const Cube&  operator=(const mtOpCube<eT, T1, op_type>& X);
+  template<typename T1, typename op_type> inline const Cube& operator+=(const mtOpCube<eT, T1, op_type>& X);
+  template<typename T1, typename op_type> inline const Cube& operator-=(const mtOpCube<eT, T1, op_type>& X);
+  template<typename T1, typename op_type> inline const Cube& operator%=(const mtOpCube<eT, T1, op_type>& X);
+  template<typename T1, typename op_type> inline const Cube& operator/=(const mtOpCube<eT, T1, op_type>& X);
+  
   template<typename T1, typename T2, typename glue_type> inline                   Cube(const GlueCube<T1, T2, glue_type>& X);
   template<typename T1, typename T2, typename glue_type> inline const Cube&  operator=(const GlueCube<T1, T2, glue_type>& X);
   template<typename T1, typename T2, typename glue_type> inline const Cube& operator+=(const GlueCube<T1, T2, glue_type>& X);
@@ -131,7 +149,14 @@
   template<typename T1, typename T2, typename eglue_type> inline const Cube& operator%=(const eGlueCube<T1, T2, eglue_type>& X);
   template<typename T1, typename T2, typename eglue_type> inline const Cube& operator/=(const eGlueCube<T1, T2, eglue_type>& X);
   
+  template<typename T1, typename T2, typename glue_type> inline                   Cube(const mtGlueCube<eT, T1, T2, glue_type>& X);
+  template<typename T1, typename T2, typename glue_type> inline const Cube&  operator=(const mtGlueCube<eT, T1, T2, glue_type>& X);
+  template<typename T1, typename T2, typename glue_type> inline const Cube& operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X);
+  template<typename T1, typename T2, typename glue_type> inline const Cube& operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X);
+  template<typename T1, typename T2, typename glue_type> inline const Cube& operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X);
+  template<typename T1, typename T2, typename glue_type> inline const Cube& operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X);
   
+  
   arma_inline eT& operator[] (const u32 i);
   arma_inline eT  operator[] (const u32 i) const;
   arma_inline eT& operator() (const u32 i);
@@ -174,14 +199,20 @@
   
   template<typename eT2> inline void copy_size(const Cube<eT2>& m);
   
-  inline void fill(const eT val);
+  inline const Cube& fill(const eT val);
   
-  inline void zeros();
-  inline void zeros(const u32 in_rows, const u32 in_cols, const u32 in_slices);
+  inline const Cube& zeros();
+  inline const Cube& zeros(const u32 in_rows, const u32 in_cols, const u32 in_slices);
   
-  inline void ones();
-  inline void ones(const u32 in_rows, const u32 in_cols, const u32 in_slices);
+  inline const Cube& ones();
+  inline const Cube& ones(const u32 in_rows, const u32 in_cols, const u32 in_slices);
   
+  inline const Cube& randu();
+  inline const Cube& randu(const u32 in_rows, const u32 in_cols, const u32 in_slices);
+  
+  inline const Cube& randn();
+  inline const Cube& randn(const u32 in_rows, const u32 in_cols, const u32 in_slices);
+  
   inline void reset();
   
   
@@ -266,11 +297,13 @@
   template<typename T1, typename T2>
   inline void init(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
   
+  inline void steal_mem(Cube& X);
   
   inline void delete_mat();
   inline void create_mat();
   
   friend class op_reshape;
+  friend class glue_join;
   };
 
 
@@ -278,7 +311,7 @@
 class Cube_aux
   {
   public:
-
+  
   template<typename eT> arma_inline static void prefix_pp(Cube<eT>& x);
   template<typename T>  arma_inline static void prefix_pp(Cube< std::complex<T> >& x);
   
@@ -292,16 +325,10 @@
   template<typename T>  arma_inline static void postfix_mm(Cube< std::complex<T> >& x);
   
   template<typename eT, typename T1> inline static void set_real(Cube<eT>&                out, const BaseCube<eT,T1>& X);
+  template<typename eT, typename T1> inline static void set_imag(Cube<eT>&                out, const BaseCube<eT,T1>& X);
+  
   template<typename T,  typename T1> inline static void set_real(Cube< std::complex<T> >& out, const BaseCube< T,T1>& X);
-  
[TRUNCATED]

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


More information about the Rcpp-commits mailing list