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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 12 15:18:19 CEST 2012


Author: edd
Date: 2012-04-12 15:18:19 +0200 (Thu, 12 Apr 2012)
New Revision: 3574

Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/NEWS
   pkg/RcppArmadillo/inst/include/armadillo
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
Log:
Release 0.3.0.1 with Armadillo 3.0.1


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2012-04-12 03:56:14 UTC (rev 3573)
+++ pkg/RcppArmadillo/ChangeLog	2012-04-12 13:18:19 UTC (rev 3574)
@@ -1,3 +1,9 @@
+2012-04-12  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.3.0.1
+
+	* inst/include/*: Upgraded to new release 3.0.1 of Armadillo
+
 2012-04-11  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/RcppArmadilloConfig.h: Protect define of

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2012-04-12 03:56:14 UTC (rev 3573)
+++ pkg/RcppArmadillo/DESCRIPTION	2012-04-12 13:18:19 UTC (rev 3574)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.0
+Version: 0.3.0.1
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Romain Francois, Dirk Eddelbuettel and Doug Bates <RcppArmadillo-authors at r-enthusiasts.com>
@@ -21,7 +21,7 @@
  (due to speed and/or integration capabilities), rather than another language.
  .
  The RcppArmadillo package includes the header files from the templated
- Armadillo library (currently version 3.0.0). Thus users do not need to
+ Armadillo library (currently version 3.0.1). Thus users do not need to
  install Armadillo itself in order to use RcppArmadillo.
  .
  This Armadillo integration provides a nice illustration of the 

Modified: pkg/RcppArmadillo/inst/NEWS
===================================================================
--- pkg/RcppArmadillo/inst/NEWS	2012-04-12 03:56:14 UTC (rev 3573)
+++ pkg/RcppArmadillo/inst/NEWS	2012-04-12 13:18:19 UTC (rev 3574)
@@ -1,3 +1,10 @@
+0.3.0.1 2012-04-12
+
+    o   Upgraded to Armadillo release 3.0.1
+
+    	  * fixes for compilation errors
+    	  * fixes for potential aliasing issues
+
 0.3.0   2012-04-10
 
     o   Upgraded to Armadillo release 3.0.0 "Antarctic Chilli Ranch"

Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo	2012-04-12 03:56:14 UTC (rev 3573)
+++ pkg/RcppArmadillo/inst/include/armadillo	2012-04-12 13:18:19 UTC (rev 3574)
@@ -54,6 +54,10 @@
 #endif
 
 
+#if defined(ARMA_USE_TBB_ALLOC)
+  #include <tbb/scalable_allocator.h>
+#endif
+
 #if defined(ARMA_USE_MKL_ALLOC)
   #include <mkl_service.h>
 #endif

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2012-04-12 03:56:14 UTC (rev 3573)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2012-04-12 13:18:19 UTC (rev 3574)
@@ -18,7 +18,7 @@
 
 #define ARMA_VERSION_MAJOR 3
 #define ARMA_VERSION_MINOR 0
-#define ARMA_VERSION_PATCH 0
+#define ARMA_VERSION_PATCH 1
 #define ARMA_VERSION_NAME  "Antarctic Chilli Ranch"
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp	2012-04-12 03:56:14 UTC (rev 3573)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp	2012-04-12 13:18:19 UTC (rev 3574)
@@ -17,13 +17,11 @@
 
 
 template<typename T1>
-class unwrap
+struct unwrap_default
   {
-  public:
-  
   typedef typename T1::elem_type eT;
   
-  inline unwrap(const T1& A)   // TODO: change this to Base ?
+  inline unwrap_default(const T1& A)   // TODO: change this to Base ?
     : M(A)
     {
     arma_extra_debug_sigprint();
@@ -34,11 +32,50 @@
 
 
 
+template<typename T1>
+struct unwrap_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit unwrap_Mat_fixed(const T1& A)
+    : M(A)
+    {
+    arma_extra_debug_sigprint();
+    }
+  
+  const Mat<eT>& M;
+  };
+
+
+
+template<typename T1, bool condition>
+struct unwrap_redirect {};
+
+template<typename T1>
+struct unwrap_redirect<T1, false> { typedef unwrap_default<T1>   result; };
+
+template<typename T1>
+struct unwrap_redirect<T1, true>  { typedef unwrap_Mat_fixed<T1> result; };
+
+
+template<typename T1>
+class unwrap : public unwrap_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  public:
+  
+  inline unwrap(const T1& A)
+    : unwrap_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class unwrap< Mat<eT> >
   {
   public:
-
+  
   inline unwrap(const Mat<eT>& A)
     : M(A)
     {
@@ -54,7 +91,7 @@
 class unwrap< Row<eT> >
   {
   public:
-
+  
   inline unwrap(const Row<eT>& A)
     : M(A)
     {
@@ -70,7 +107,7 @@
 class unwrap< Col<eT> >
   {
   public:
-
+  
   inline unwrap(const Col<eT>& A)
     : M(A)
     {
@@ -82,6 +119,22 @@
 
 
 
+template<typename eT>
+class unwrap< subview_col<eT> >
+  {
+  public:
+  
+  inline unwrap(const subview_col<eT>& A)
+    : M( const_cast<eT*>( A.colptr(0) ), A.n_rows, 1, false, false )
+    {
+    arma_extra_debug_sigprint();
+    }
+
+  const Mat<eT> M;
+  };
+
+
+
 template<typename out_eT, typename T1, typename T2, typename glue_type>
 class unwrap< mtGlue<out_eT, T1, T2, glue_type> >
   {
@@ -132,12 +185,6 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~unwrap_check()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
   const Mat<eT> M;
   };
 
@@ -162,10 +209,7 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   
@@ -195,10 +239,7 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   
@@ -228,10 +269,7 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   
@@ -243,6 +281,23 @@
 
 
 
+template<typename eT>
+class unwrap_check< subview_col<eT> >
+  {
+  public:
+  
+  inline
+  unwrap_check(const subview_col<eT>& A, const Mat<eT>& B)
+    : M( const_cast<eT*>( A.colptr(0) ), A.n_rows, 1, (&(A.m) == &B), false )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
+  const Mat<eT> M;
+  };
+
+
+
 //
 //
 //
@@ -264,12 +319,6 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~unwrap_check_mixed()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
   const Mat<eT1> M;
   };
 
@@ -295,10 +344,7 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   
@@ -329,10 +375,7 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   
@@ -363,10 +406,7 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   
@@ -382,37 +422,68 @@
 
 
 template<typename T1>
-class partial_unwrap
+struct partial_unwrap_default
   {
-  public:
-  
   typedef typename T1::elem_type eT;
   
-  inline partial_unwrap(const T1& A)  // TODO: change this to Base ?
+  inline partial_unwrap_default(const T1& A)
     : M(A)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  inline
-  ~partial_unwrap()
+  static const bool do_trans = false;
+  static const bool do_times = false;
+  
+  const Mat<eT> M;
+  };
+
+
+template<typename T1>
+struct partial_unwrap_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_Mat_fixed(const T1& A)
+    : M(A)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  inline eT get_val() const { return eT(1); }
-  
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
-  const Mat<eT> M;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_redirect {};
+
+template<typename T1>
+struct partial_unwrap_redirect<T1, false> { typedef partial_unwrap_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_redirect<T1, true>  { typedef partial_unwrap_Mat_fixed<T1> result; };
+
+template<typename T1>
+class partial_unwrap : public partial_unwrap_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  public:
+  
+  inline partial_unwrap(const T1& A)
+    : partial_unwrap_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap< Mat<eT> >
   {
@@ -425,17 +496,8 @@
     arma_extra_debug_sigprint();
     }
   
-  
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
@@ -456,17 +518,8 @@
     arma_extra_debug_sigprint();
     }
   
-  
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
@@ -487,57 +540,101 @@
     arma_extra_debug_sigprint();
     }
   
+  inline eT get_val() const { return eT(1); }
   
+  static const bool do_trans = false;
+  static const bool do_times = false;
+  
+  const Mat<eT>& M;
+  };
+
+
+
+template<typename eT>
+class partial_unwrap< subview_col<eT> >
+  {
+  public:
+  
   inline
-  ~partial_unwrap()
+  partial_unwrap(const subview_col<eT>& A)
+    : M( const_cast<eT*>( A.colptr(0) ), A.n_rows, 1, false, false )
     {
     arma_extra_debug_sigprint();
     }
   
-  
   inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
-  const Mat<eT>& M;
+  const Mat<eT> M;
   };
 
 
 
 template<typename T1>
-class partial_unwrap< Op<T1, op_htrans> >
+struct partial_unwrap_htrans_default
   {
-  public:
-  
   typedef typename T1::elem_type eT;
   
-  inline
-  partial_unwrap(const Op<T1,op_htrans>& A)
+  inline partial_unwrap_htrans_default(const Op<T1, op_htrans>& A)
     : M(A.m)
     {
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
+  arma_hot arma_inline eT get_val() const { return eT(1); }
+  
+  static const bool do_trans = true;
+  static const bool do_times = false;
+  
+  const Mat<eT> M;
+  };
+
+
+template<typename T1>
+struct partial_unwrap_htrans_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_htrans_Mat_fixed(const Op<T1, op_htrans>& A)
+    : M(A.m)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  inline eT get_val() const { return eT(1); }
-  
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
-  const Mat<eT> M;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_htrans_redirect {};
+
+template<typename T1>
+struct partial_unwrap_htrans_redirect<T1, false> { typedef partial_unwrap_htrans_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_htrans_redirect<T1, true>  { typedef partial_unwrap_htrans_Mat_fixed<T1> result; };
+
+template<typename T1>
+class partial_unwrap< Op<T1, op_htrans> > : public partial_unwrap_htrans_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  public:
+  
+  inline partial_unwrap(const Op<T1, op_htrans>& A)
+    : partial_unwrap_htrans_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap< Op< Mat<eT>, op_htrans> >
   {
@@ -550,17 +647,8 @@
     arma_extra_debug_sigprint();
     }
   
+  arma_inline eT get_val() const { return eT(1); }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
-  inline eT get_val() const { return eT(1); }
-  
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
@@ -581,16 +669,8 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
+  arma_inline eT get_val() const { return eT(1); }
   
-  
-  inline eT get_val() const { return eT(1); }
-  
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
@@ -611,58 +691,105 @@
     arma_extra_debug_sigprint();
     }
   
+  arma_inline eT get_val() const { return eT(1); }
+  
+  static const bool do_trans = true;
+  static const bool do_times = false;
+  
+  const Mat<eT>& M;
+  };
+
+
+
+template<typename eT>
+class partial_unwrap< Op< subview_col<eT>, op_htrans> >
+  {
+  public:
+  
   inline
-  ~partial_unwrap()
+  partial_unwrap(const Op< subview_col<eT>, op_htrans>& A)
+    : M( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, 1, false, false )
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_inline eT get_val() const { return eT(1); }
   
-  inline eT get_val() const { return eT(1); }
-  
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
-  const Mat<eT>& M;
+  const Mat<eT> M;
   };
 
 
 
 template<typename T1>
-class partial_unwrap< Op<T1, op_htrans2> >
+struct partial_unwrap_htrans2_default
   {
-  public:
-  
   typedef typename T1::elem_type eT;
   
-  inline
-  partial_unwrap(const Op<T1,op_htrans2>& A)
+  inline partial_unwrap_htrans2_default(const Op<T1, op_htrans2>& A)
     : val(A.aux)
     , M  (A.m)
     {
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
+  arma_inline eT get_val() const { return val; }
+  
+  static const bool do_trans = true;
+  static const bool do_times = true;
+  
+  const eT      val;
+  const Mat<eT> M;
+  };
+
+
+template<typename T1>
+struct partial_unwrap_htrans2_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_htrans2_Mat_fixed(const Op<T1, op_htrans2>& A)
+    : val(A.aux)
+    , M  (A.m)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_inline eT get_val() const { return val; }
   
-  inline eT get_val() const { return val; }
-  
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
   const eT      val;
-  const Mat<eT> M;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_htrans2_redirect {};
+
+template<typename T1>
+struct partial_unwrap_htrans2_redirect<T1, false> { typedef partial_unwrap_htrans2_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_htrans2_redirect<T1, true>  { typedef partial_unwrap_htrans2_Mat_fixed<T1> result; };
+
+template<typename T1>
+class partial_unwrap< Op<T1, op_htrans2> > : public partial_unwrap_htrans2_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  public:
+  
+  inline partial_unwrap(const Op<T1, op_htrans2>& A)
+    : partial_unwrap_htrans2_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap< Op< Mat<eT>, op_htrans2> >
   {
@@ -676,16 +803,8 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
@@ -708,16 +827,8 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
@@ -740,59 +851,111 @@
     arma_extra_debug_sigprint();
     }
   
+  inline eT get_val() const { return val; }
+  
+  static const bool do_trans = true;
+  static const bool do_times = true;
+  
+  const eT       val;
+  const Mat<eT>& M;
+  };
+
+
+
+template<typename eT>
+class partial_unwrap< Op< subview_col<eT>, op_htrans2> >
+  {
+  public:
+  
   inline
-  ~partial_unwrap()
+  partial_unwrap(const Op< subview_col<eT>, op_htrans2>& A)
+    : val( A.aux )
+    , M  ( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, 1, false, false )
     {
     arma_extra_debug_sigprint();
     }
   
-  
   inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
-  const eT       val;
-  const Mat<eT>& M;
+  const eT      val;
+  const Mat<eT> M;
   };
 
 
 
 template<typename T1>
-class partial_unwrap< eOp<T1, eop_scalar_times> >
+struct partial_unwrap_scalar_times_default
   {
-  public:
-  
   typedef typename T1::elem_type eT;
   
-  inline
-  partial_unwrap(const eOp<T1,eop_scalar_times>& A)
+  inline partial_unwrap_scalar_times_default(const eOp<T1, eop_scalar_times>& A)
     : val(A.aux)
     , M  (A.P.Q)
     {
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
+  arma_hot arma_inline eT get_val() const { return val; }
+  
+  static const bool do_trans = false;
+  static const bool do_times = true;
+  
+  const eT      val;
+  const Mat<eT> M;
+  };
+
+
+
+template<typename T1>
+struct partial_unwrap_scalar_times_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_scalar_times_Mat_fixed(const eOp<T1, eop_scalar_times>& A)
+    : val(A.aux)
+    , M  (A.P.Q)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return val; }
   
-  inline eT get_val() const { return val; }
-  
-  
   static const bool do_trans = false;
   static const bool do_times = true;
   
-  const eT      val;
-  const Mat<eT> M;
+  const eT       val;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_scalar_times_redirect {};
+
+template<typename T1>
+struct partial_unwrap_scalar_times_redirect<T1, false> { typedef partial_unwrap_scalar_times_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_scalar_times_redirect<T1, true>  { typedef partial_unwrap_scalar_times_Mat_fixed<T1> result; };
+
+
+template<typename T1>
+class partial_unwrap< eOp<T1, eop_scalar_times> > : public partial_unwrap_scalar_times_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  typedef typename T1::elem_type eT;
+  
+  public:
+  inline partial_unwrap(const eOp<T1, eop_scalar_times>& A)
+    : partial_unwrap_scalar_times_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> >
   {
@@ -806,16 +969,8 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = false;
   static const bool do_times = true;
   
@@ -838,16 +993,8 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = false;
   static const bool do_times = true;
   
@@ -870,16 +1017,8 @@
     arma_extra_debug_sigprint();
     }
   
-  inline
-  ~partial_unwrap()
-    {
-    arma_extra_debug_sigprint();
-    }
-  
-  
   inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = false;
   static const bool do_times = true;
   
@@ -894,38 +1033,79 @@
 
 
 template<typename T1>
-class partial_unwrap_check
+struct partial_unwrap_check_default
   {
-  public:
-  
   typedef typename T1::elem_type eT;
   
-  arma_hot inline
-  partial_unwrap_check(const T1& A, const Mat<eT>&)
+  inline partial_unwrap_check_default(const T1& A, const Mat<eT>&)
     : M(A)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return eT(1); }
   
+  static const bool do_trans = false;
+  static const bool do_times = false;
+  
+  const Mat<eT> M;
+  };
+
+
+template<typename T1>
+struct partial_unwrap_check_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_check_Mat_fixed(const T1& A, const Mat<eT>& B)
+    : M_local( (&A == &B) ? new Mat<eT>(A) : 0 )
+    , M      ( (&A == &B) ? (*M_local)     : A )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
   inline
-  ~partial_unwrap_check()
+  ~partial_unwrap_check_Mat_fixed()
     {
     arma_extra_debug_sigprint();
+    
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
-  const Mat<eT> M;
+  const Mat<eT>* M_local;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_check_redirect {};
+
+template<typename T1>
+struct partial_unwrap_check_redirect<T1, false> { typedef partial_unwrap_check_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_check_redirect<T1, true>  { typedef partial_unwrap_check_Mat_fixed<T1> result; };
+
+template<typename T1>
+class partial_unwrap_check : public partial_unwrap_check_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  typedef typename T1::elem_type eT;
+  
+  public:
+  inline partial_unwrap_check(const T1& A, const Mat<eT>& B)
+    : partial_unwrap_check_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap_check< Mat<eT> >
   {
@@ -945,16 +1125,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
@@ -984,15 +1159,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
@@ -1022,16 +1193,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = false;
   static const bool do_times = false;
   
@@ -1042,38 +1208,103 @@
 
 
 
-template<typename T1>
-class partial_unwrap_check< Op<T1, op_htrans> >
+template<typename eT>
+class partial_unwrap_check< subview_col<eT> >
   {
   public:
   
+  arma_hot inline
+  partial_unwrap_check(const subview_col<eT>& A, const Mat<eT>& B)
+    : M( const_cast<eT*>( A.colptr(0) ), A.n_rows, 1, (&(A.m) == &B), false )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
+  arma_hot arma_inline eT get_val() const { return eT(1); }
+  
+  static const bool do_trans = false;
+  static const bool do_times = false;
+  
+  const Mat<eT> M;
+  };
+
+
+
+template<typename T1>
+struct partial_unwrap_check_htrans_default
+  {
   typedef typename T1::elem_type eT;
   
-  arma_hot inline
-  partial_unwrap_check(const Op<T1,op_htrans>& A, const Mat<eT>&)
+  inline partial_unwrap_check_htrans_default(const Op<T1, op_htrans>& A, const Mat<eT>&)
     : M(A.m)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return eT(1); }
+  
+  static const bool do_trans = true;
+  static const bool do_times = false;
+  
+  const Mat<eT> M;
+  };
+
+
+template<typename T1>
+struct partial_unwrap_check_htrans_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_check_htrans_Mat_fixed(const Op<T1, op_htrans>& A, const Mat<eT>& B)
+    : M_local( (&(A.m) == &B) ? new Mat<eT>(A.m) : 0   )
+    , M      ( (&(A.m) == &B) ? (*M_local)       : A.m )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
   inline
-  ~partial_unwrap_check()
+  ~partial_unwrap_check_htrans_Mat_fixed()
     {
     arma_extra_debug_sigprint();
+    
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
-  const Mat<eT> M;
+  const Mat<eT>* M_local;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_check_htrans_redirect {};
+
+template<typename T1>
+struct partial_unwrap_check_htrans_redirect<T1, false> { typedef partial_unwrap_check_htrans_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_check_htrans_redirect<T1, true>  { typedef partial_unwrap_check_htrans_Mat_fixed<T1> result; };
+
+
+template<typename T1>
+class partial_unwrap_check< Op<T1, op_htrans> > : public partial_unwrap_check_htrans_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  typedef typename T1::elem_type eT;
+  
+  public:
+  inline partial_unwrap_check(const Op<T1, op_htrans>& A, const Mat<eT>& B)
+    : partial_unwrap_check_htrans_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap_check< Op< Mat<eT>, op_htrans> >
   {
@@ -1092,16 +1323,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
@@ -1130,16 +1356,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
@@ -1168,16 +1389,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return eT(1); }
   
-  
   static const bool do_trans = true;
   static const bool do_times = false;
   
@@ -1188,40 +1404,108 @@
 
 
 
-template<typename T1>
-class partial_unwrap_check< Op<T1, op_htrans2> >
+template<typename eT>
+class partial_unwrap_check< Op< subview_col<eT>, op_htrans> >
   {
   public:
   
+  arma_hot inline
+  partial_unwrap_check(const Op< subview_col<eT>, op_htrans>& A, const Mat<eT>& B)
+    : M( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, 1, (&(A.m.m) == &B), false )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
+  arma_hot arma_inline eT get_val() const { return eT(1); }
+  
+  static const bool do_trans = true;
+  static const bool do_times = false;
+  
+  const Mat<eT> M;
+  };
+
+
+
+template<typename T1>
+struct partial_unwrap_check_htrans2_default
+  {
   typedef typename T1::elem_type eT;
   
-  arma_hot inline
-  partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>&)
+  inline partial_unwrap_check_htrans2_default(const Op<T1, op_htrans2>& A, const Mat<eT>&)
     : val(A.aux)
     , M  (A.m)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return val; }
+  
+  static const bool do_trans = true;
+  static const bool do_times = true;
+  
+  const eT      val;
+  const Mat<eT> M;
+  };
+
+
+
+template<typename T1>
+struct partial_unwrap_check_htrans2_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_check_htrans2_Mat_fixed(const Op<T1, op_htrans2>& A, const Mat<eT>& B)
+    : val    (A.aux)
+    , M_local( (&(A.m) == &B) ? new Mat<eT>(A.m) : 0   )
+    , M      ( (&(A.m) == &B) ? (*M_local)       : A.m )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
   inline
-  ~partial_unwrap_check()
+  ~partial_unwrap_check_htrans2_Mat_fixed()
     {
     arma_extra_debug_sigprint();
+    
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
-  const eT      val;
-  const Mat<eT> M;
+  const eT       val;
+  const Mat<eT>* M_local;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_check_htrans2_redirect {};
+
+template<typename T1>
+struct partial_unwrap_check_htrans2_redirect<T1, false> { typedef partial_unwrap_check_htrans2_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_check_htrans2_redirect<T1, true>  { typedef partial_unwrap_check_htrans2_Mat_fixed<T1> result; };
+
+
+template<typename T1>
+class partial_unwrap_check< Op<T1, op_htrans2> > : public partial_unwrap_check_htrans2_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  typedef typename T1::elem_type eT;
+  
+  public:
+  inline partial_unwrap_check(const Op<T1, op_htrans2>& A, const Mat<eT>& B)
+    : partial_unwrap_check_htrans2_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap_check< Op< Mat<eT>, op_htrans2> >
   {
@@ -1241,16 +1525,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
@@ -1281,16 +1560,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
@@ -1308,7 +1582,7 @@
   public:
   
   arma_hot inline
-  partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B)
+  partial_unwrap_check(const Op< Col<eT>, op_htrans2>& A, const Mat<eT>& B)
     : val     (A.aux)
     , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0   )
     , M       ( (&A.m == &B) ? (*M_local)       : A.m )
@@ -1321,16 +1595,11 @@
     {
     arma_extra_debug_sigprint();
     
-    if(M_local)
-      {
-      delete M_local;
-      }
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = true;
   static const bool do_times = true;
   
@@ -1342,49 +1611,120 @@
 
 
 
-template<typename T1>
-class partial_unwrap_check< eOp<T1, eop_scalar_times> >
+template<typename eT>
+class partial_unwrap_check< Op< subview_col<eT>, op_htrans2> >
   {
   public:
   
+  arma_hot inline
+  partial_unwrap_check(const Op< subview_col<eT>, op_htrans2>& A, const Mat<eT>& B)
+    : val( A.aux )
+    , M  ( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, 1, (&(A.m.m) == &B), false )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
+  arma_hot arma_inline eT get_val() const { return val; }
+  
+  static const bool do_trans = true;
+  static const bool do_times = true;
+  
+  const eT      val;
+  const Mat<eT> M;
+  };
+
+
+
+template<typename T1>
+struct partial_unwrap_check_scalar_times_default
+  {
   typedef typename T1::elem_type eT;
   
-  arma_hot inline
-  partial_unwrap_check(const eOp<T1,eop_scalar_times>& A, const Mat<eT>&)
+  inline partial_unwrap_check_scalar_times_default(const eOp<T1, eop_scalar_times>& A, const Mat<eT>&)
     : val(A.aux)
     , M  (A.P.Q)
     {
     arma_extra_debug_sigprint();
     }
   
+  arma_hot arma_inline eT get_val() const { return val; }
+  
+  static const bool do_trans = false;
+  static const bool do_times = true;
+  
+  const eT      val;
+  const Mat<eT> M;
+  };
+
+
+
+template<typename T1>
+struct partial_unwrap_check_scalar_times_Mat_fixed
+  {
+  typedef typename T1::elem_type eT;
+  
+  inline explicit partial_unwrap_check_scalar_times_Mat_fixed(const eOp<T1, eop_scalar_times>& A, const Mat<eT>& B)
+    : val    ( A.aux )
+    , M_local( (&(A.P.Q) == &B) ? new Mat<eT>(A.P.Q) : 0     )
+    , M      ( (&(A.P.Q) == &B) ? (*M_local)         : A.P.Q )
+    {
+    arma_extra_debug_sigprint();
+    }
+  
   inline
-  ~partial_unwrap_check()
+  ~partial_unwrap_check_scalar_times_Mat_fixed()
     {
     arma_extra_debug_sigprint();
+    
+    if(M_local) { delete M_local; }
     }
   
-  
   arma_hot arma_inline eT get_val() const { return val; }
   
-  
   static const bool do_trans = false;
   static const bool do_times = true;
   
-  const eT      val;
-  const Mat<eT> M;
+  const eT       val;
+  const Mat<eT>* M_local;
+  const Mat<eT>& M;
   };
 
 
 
+template<typename T1, bool condition>
+struct partial_unwrap_check_scalar_times_redirect {};
+
+template<typename T1>
+struct partial_unwrap_check_scalar_times_redirect<T1, false> { typedef partial_unwrap_check_scalar_times_default<T1>   result; };
+
+template<typename T1>
+struct partial_unwrap_check_scalar_times_redirect<T1, true>  { typedef partial_unwrap_check_scalar_times_Mat_fixed<T1> result; };
+
+
+template<typename T1>
+class partial_unwrap_check< eOp<T1, eop_scalar_times> > : public partial_unwrap_check_scalar_times_redirect<T1, is_Mat_fixed<T1>::value >::result
+  {
+  typedef typename T1::elem_type eT;
+  
+  public:
+  inline partial_unwrap_check(const eOp<T1, eop_scalar_times>& A, const Mat<eT>& B)
+    : partial_unwrap_check_scalar_times_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
+    {
+    }
+  };
+
+
+
 template<typename eT>
 class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> >
   {
   public:
   
   arma_hot inline
-  partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT>&)
-    : val(A.aux)
-    , M  (A.P.Q)
+  partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT>& B)
+    : val    (A.aux)
+    , M_local( (&(A.P.Q) == &B) ? new Mat<eT>(A.P.Q) : 0     )
+    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
     {
     arma_extra_debug_sigprint();
     }
@@ -1393,16 +1733,17 @@
[TRUNCATED]

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


More information about the Rcpp-commits mailing list