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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 28 18:01:50 CEST 2012


Author: edd
Date: 2012-03-28 18:01:49 +0200 (Wed, 28 Mar 2012)
New Revision: 3555

Added:
   pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/memory.hpp
Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/NEWS
   pkg/RcppArmadillo/inst/include/armadillo
   pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_accu.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_dot.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_princomp.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_median_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_median_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_div.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_minus.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_plus.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_relational.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_schur.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/operator_times.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/podarray_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/restrictors.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/strip.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap_cube.hpp
Log:
RcppArmadillo 0.2.38 with Armadillo 2.99.2


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/ChangeLog	2012-03-28 16:01:49 UTC (rev 3555)
@@ -1,3 +1,9 @@
+2012-03-28  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.2.38
+
+	* inst/include/*: Upgraded to new test release 2.99.2 of Armadillo
+
 2012-03-24  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.2.37

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/DESCRIPTION	2012-03-28 16:01:49 UTC (rev 3555)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.37
+Version: 0.2.38
 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 2.99.1). Thus users do not need to
+ Armadillo library (currently version 2.99.2). 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-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/NEWS	2012-03-28 16:01:49 UTC (rev 3555)
@@ -1,6 +1,15 @@
+0.2.38  2012-03-28
+
+    o   Upgraded to Armadillo release 2.99.2 "Antarctic Chilli Ranch (Beta 2)"
+
+    	  * added .i()
+    	  * much faster handling of .col() and .row()
+    	  * expressions X=A.i()*B and X=inv(A)*B are automatically converted
+    	    to X=solve(A,B) 
+
 0.2.37  2012-03-19
 
-    o   Upgraded to Armadillo test release 2.99.1 "Antarctic Chilli Ranch (Beta 1)"
+    o   Upgraded to Armadillo release 2.99.1 "Antarctic Chilli Ranch (Beta 1)"
 
     	  * added non-contiguous submatrix views
 	  * added hist() and histc()

Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo	2012-03-28 16:01:49 UTC (rev 3555)
@@ -54,6 +54,11 @@
 #endif
 
 
+#if defined(ARMA_USE_MKL_ALLOC)
+  #include <mkl_service.h>
+#endif
+
+
 #if defined(ARMA_HAVE_STD_TR1)
   // TODO: add handling of this functionality when use of C++11 is enabled
   #include <tr1/cmath>
@@ -96,6 +101,7 @@
   #include "armadillo_bits/upgrade_val.hpp"
   #include "armadillo_bits/restrictors.hpp"
   #include "armadillo_bits/access.hpp"
+  #include "armadillo_bits/memory.hpp"
   #include "armadillo_bits/span.hpp"
   #include "armadillo_bits/constants.hpp"
   #include "armadillo_bits/constants_compat.hpp"
@@ -115,6 +121,7 @@
   #include "armadillo_bits/lapack_wrapper.hpp"
   #include "armadillo_bits/atlas_wrapper.hpp"
   
+  #include "armadillo_bits/cond_rel_bones.hpp"
   #include "armadillo_bits/arrayops_bones.hpp"
   #include "armadillo_bits/podarray_bones.hpp"
   #include "armadillo_bits/auxlib_bones.hpp"
@@ -369,6 +376,7 @@
   #include "armadillo_bits/eop_core_meat.hpp"
   #include "armadillo_bits/eglue_core_meat.hpp"
   
+  #include "armadillo_bits/cond_rel_meat.hpp"
   #include "armadillo_bits/arrayops_meat.hpp"
   #include "armadillo_bits/podarray_meat.hpp"
   #include "armadillo_bits/auxlib_meat.hpp"

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -16,31 +16,49 @@
 
 
 
+template<typename derived>
+struct Base_blas_elem_type
+  {
+  arma_inline const Op<derived,op_inv> i(const bool slow = false) const;   //!< matrix inverse
+  };
+
+
+template<typename derived>
+struct Base_other_elem_type
+  {
+  };
+
+
+template<typename derived, bool condition>
+struct Base_extra {};
+
+template<typename derived>
+struct Base_extra<derived, true>  { typedef Base_blas_elem_type<derived>  result; };
+
+template<typename derived>
+struct Base_extra<derived, false> { typedef Base_other_elem_type<derived> result; };
+
+
+
 //! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP).
 //! Used for type-safe downcasting in functions that restrict their input(s) to be classes that are
 //! derived from Base (e.g. Mat, Op, Glue, diagview, subview).
 //! A Base object can be converted to a Mat object by the unwrap class.
 
 template<typename elem_type, typename derived>
-struct Base
+struct Base : public Base_extra<derived, is_supported_blas_type<elem_type>::value>::result
   {
   arma_inline const derived& get_ref() const;
   
-  arma_inline const Op<derived,op_htrans>  t() const;
-  arma_inline const Op<derived,op_htrans> ht() const;
-  arma_inline const Op<derived,op_strans> st() const;
+  arma_inline const Op<derived,op_htrans>  t() const;  //!< Hermitian transpose
+  arma_inline const Op<derived,op_htrans> ht() const;  //!< Hermitian transpose
+  arma_inline const Op<derived,op_strans> st() const;  //!< simple transpose
   
   inline void print(const std::string extra_text = "") const;
   inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
   
   inline void raw_print(const std::string extra_text = "") const;
   inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
-  
-  arma_deprecated inline void print_trans(const std::string extra_text = "") const;
-  arma_deprecated inline void print_trans(std::ostream& user_stream, const std::string extra_text = "") const;
-  
-  arma_deprecated inline void raw_print_trans(const std::string extra_text = "") const;
-  arma_deprecated inline void raw_print_trans(std::ostream& user_stream, const std::string extra_text = "") const;
   };
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -56,6 +56,7 @@
 
 
 
+
 template<typename elem_type, typename derived>
 inline
 void
@@ -83,30 +84,6 @@
 template<typename elem_type, typename derived>
 inline
 void
-Base<elem_type,derived>::print_trans(const std::string extra_text) const
-  {
-  const unwrap<derived> tmp( (*this).get_ref() );
-  
-  tmp.M.impl_print_trans(extra_text);
-  }
-
-
-
-template<typename elem_type, typename derived>
-inline
-void
-Base<elem_type,derived>::print_trans(std::ostream& user_stream, const std::string extra_text) const
-  {
-  const unwrap<derived> tmp( (*this).get_ref() );
-  
-  tmp.M.impl_print_trans(user_stream, extra_text);
-  }
-  
-
-
-template<typename elem_type, typename derived>
-inline
-void
 Base<elem_type,derived>::raw_print(const std::string extra_text) const
   {
   const unwrap<derived> tmp( (*this).get_ref() );
@@ -125,29 +102,18 @@
   
   tmp.M.impl_raw_print(user_stream, extra_text);
   }
-  
 
 
-template<typename elem_type, typename derived>
-inline
-void
-Base<elem_type,derived>::raw_print_trans(const std::string extra_text) const
-  {
-  const unwrap<derived> tmp( (*this).get_ref() );
-  
-  tmp.M.impl_raw_print_trans(extra_text);
-  }
 
+//
+// extra functions defined in Base_blas_elem_type
 
-
-template<typename elem_type, typename derived>
-inline
-void
-Base<elem_type,derived>::raw_print_trans(std::ostream& user_stream, const std::string extra_text) const
+template<typename derived>
+arma_inline
+const Op<derived,op_inv>
+Base_blas_elem_type<derived>::i(const bool slow) const
   {
-  const unwrap<derived> tmp( (*this).get_ref() );
-  
-  tmp.M.impl_raw_print_trans(user_stream, extra_text);
+  return Op<derived,op_inv>( static_cast<const derived&>(*this), ((slow == false) ? 0 : 1), 0 );
   }
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -90,6 +90,13 @@
   template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
   
   
+  arma_inline arma_warn_unused eT& at(const uword i);
+  arma_inline arma_warn_unused eT  at(const uword i) const;
+  
+  arma_inline arma_warn_unused eT& at(const uword in_row, const uword in_col);
+  arma_inline arma_warn_unused eT  at(const uword in_row, const uword in_col) const;
+  
+  
   typedef       eT*       row_iterator;
   typedef const eT* const_row_iterator;
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -631,6 +631,50 @@
 
 
 template<typename eT>
+arma_inline
+arma_warn_unused
+eT&
+Col<eT>::at(const uword i)
+  {
+  return access::rw(Mat<eT>::mem[i]);
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT
+Col<eT>::at(const uword i) const
+  {
+  return Mat<eT>::mem[i];
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT&
+Col<eT>::at(const uword in_row, const uword)
+  {
+  return access::rw( Mat<eT>::mem[in_row] );
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT
+Col<eT>::at(const uword in_row, const uword) const
+  {
+  return Mat<eT>::mem[in_row];
+  }
+
+
+
+template<typename eT>
 inline
 typename Col<eT>::row_iterator
 Col<eT>::begin_row(const uword row_num)
@@ -1076,7 +1120,7 @@
 arma_inline
 arma_warn_unused
 eT&
-Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col)
+Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword)
   {
   return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row];
   }
@@ -1088,7 +1132,7 @@
 arma_inline
 arma_warn_unused
 eT
-Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) const
+Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword) const
   {
   return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row];
   }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -27,11 +27,7 @@
     {
     if(n_elem > Cube_prealloc::mem_n_elem)
       {
-      #if defined(ARMA_USE_TBB_ALLOC)
-        scalable_free((void *)(mem));
-      #else
-        delete [] mem;
-      #endif
+      memory::release( access::rw(mem) );
       }
     }
   
@@ -113,11 +109,7 @@
     {
     arma_extra_debug_print("Cube::init(): allocating memory");
     
-    #if defined(ARMA_USE_TBB_ALLOC)
-      access::rw(mem) = (eT *)scalable_malloc(sizeof(eT)*n_elem);
-    #else
-      access::rw(mem) = new(std::nothrow) eT[n_elem];
-    #endif
+    access::rw(mem) = memory::acquire<eT>(n_elem);
     
     arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" );
     }
@@ -208,11 +200,7 @@
         {
         arma_extra_debug_print("Cube::init(): freeing memory");
         
-        #if defined(ARMA_USE_TBB_ALLOC)
-          scalable_free((void *)(mem));
-        #else
-          delete [] mem;
-        #endif
+        memory::release( access::rw(mem) );
         }
       }
     
@@ -226,11 +214,7 @@
       {
       arma_extra_debug_print("Cube::init(): allocating memory");
       
-      #if defined(ARMA_USE_TBB_ALLOC)
-        access::rw(mem) = (eT *)scalable_malloc(sizeof(eT)*new_n_elem);
-      #else
-        access::rw(mem) = new(std::nothrow) eT[new_n_elem];
-      #endif
+      access::rw(mem) = memory::acquire<eT>(new_n_elem);
       
       arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" );
       }
@@ -3325,7 +3309,7 @@
 template<typename eT, typename T1>
 inline
 void
-Cube_aux::set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X)
+Cube_aux::set_imag(Cube<eT>&, const BaseCube<eT,T1>&)
   {
   arma_extra_debug_sigprint();
   }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -25,11 +25,7 @@
     {
     if(n_elem > arma_config::mat_prealloc)
       {
-      #if defined(ARMA_USE_TBB_ALLOC)
-        scalable_free((void *)(mem));
-      #else
-        delete [] mem;
-      #endif
+      memory::release( access::rw(mem) );
       }
     }
     
@@ -141,11 +137,7 @@
     {
     arma_extra_debug_print("Mat::init(): allocating memory");
     
-    #if defined(ARMA_USE_TBB_ALLOC)
-      access::rw(mem) = (eT *) scalable_malloc(sizeof(eT)*n_elem);
-    #else
-      access::rw(mem) = new(std::nothrow) eT[n_elem];
-    #endif
+    access::rw(mem) = memory::acquire<eT>(n_elem);
     
     arma_check_bad_alloc( (mem == 0), "Mat::init(): out of memory" );
     }
@@ -246,11 +238,7 @@
         {
         arma_extra_debug_print("Mat::init(): freeing memory");
         
-        #if defined(ARMA_USE_TBB_ALLOC)
-          scalable_free((void *)(mem));
-        #else
-          delete [] mem;
-        #endif
+        memory::release( access::rw(mem) );
         }
       }
     
@@ -263,11 +251,7 @@
       {
       arma_extra_debug_print("Mat::init(): allocating memory");
       
-      #if defined(ARMA_USE_TBB_ALLOC)
-        access::rw(mem) = (eT *) scalable_malloc(sizeof(eT)*new_n_elem);
-      #else
-        access::rw(mem) = new(std::nothrow) eT[new_n_elem];
-      #endif
+      access::rw(mem) = memory::acquire<eT>(new_n_elem);
       
       arma_check_bad_alloc( (mem == 0), "Mat::init(): out of memory" );
       }
@@ -6294,7 +6278,7 @@
 template<typename eT, typename T1>
 inline
 void
-Mat_aux::set_imag(Mat<eT>& out, const Base<eT,T1>& X)
+Mat_aux::set_imag(Mat<eT>&, const Base<eT,T1>&)
   {
   arma_extra_debug_sigprint();
   }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -20,7 +20,7 @@
 class Proxy
   {
   public:
-  inline Proxy(const T1& A)
+  inline Proxy(const T1&)
     {
     arma_type_check(( is_arma_type<T1>::value == false ));
     }
@@ -352,9 +352,9 @@
   typedef eT                                       elem_type;
   typedef typename get_pod_type<elem_type>::result pod_type;
   typedef subview_col<eT>                          stored_type;
-  typedef const subview_col<eT>&                   ea_type;
+  typedef const eT*                                ea_type;
   
-  static const bool prefer_at_accessor = true;
+  static const bool prefer_at_accessor = false;
   static const bool has_subview        = true;
   
   static const bool is_row = false;
@@ -372,10 +372,10 @@
   arma_inline uword get_n_cols() const { return 1;        }
   arma_inline uword get_n_elem() const { return Q.n_elem; }
   
-  arma_inline elem_type operator[] (const uword i)                const { return Q[i];         }
-  arma_inline elem_type at         (const uword row, const uword) const { return Q.at(row, 0); }
+  arma_inline elem_type operator[] (const uword i)                const { return Q[i];   }
+  arma_inline elem_type at         (const uword row, const uword) const { return Q[row]; }
   
-  arma_inline ea_type get_ea() const { return Q; }
+  arma_inline ea_type get_ea() const { return Q.colptr(0); }
   
   template<typename eT2>
   arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
@@ -393,7 +393,7 @@
   typedef subview_row<eT>                          stored_type;
   typedef const subview_row<eT>&                   ea_type;
   
-  static const bool prefer_at_accessor = true;
+  static const bool prefer_at_accessor = false;
   static const bool has_subview        = true;
   
   static const bool is_row = true;
@@ -411,8 +411,8 @@
   arma_inline uword get_n_cols() const { return Q.n_cols; }
   arma_inline uword get_n_elem() const { return Q.n_elem; }
   
-  arma_inline elem_type operator[] (const uword i)                const { return Q[i];         }
-  arma_inline elem_type at         (const uword, const uword col) const { return Q.at(0, col); }
+  arma_inline elem_type operator[] (const uword i)                const { return Q[i];   }
+  arma_inline elem_type at         (const uword, const uword col) const { return Q[col]; }
   
   arma_inline ea_type get_ea() const { return Q; }
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -20,7 +20,7 @@
 class ProxyCube
   {
   public:
-  inline ProxyCube(const T1& A)
+  inline ProxyCube(const T1&)
     {
     arma_type_check(( is_arma_cube_type<T1>::value == false ));
     }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -90,6 +90,13 @@
   template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
   
   
+  arma_inline arma_warn_unused eT& at(const uword i);
+  arma_inline arma_warn_unused eT  at(const uword i) const;
+  
+  arma_inline arma_warn_unused eT& at(const uword in_row, const uword in_col);
+  arma_inline arma_warn_unused eT  at(const uword in_row, const uword in_col) const;
+  
+  
   typedef       eT*       row_iterator;
   typedef const eT* const_row_iterator;
   

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -597,6 +597,50 @@
 
 
 template<typename eT>
+arma_inline
+arma_warn_unused
+eT&
+Row<eT>::at(const uword i)
+  {
+  return access::rw(Mat<eT>::mem[i]);
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT
+Row<eT>::at(const uword i) const
+  {
+  return Mat<eT>::mem[i];
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT&
+Row<eT>::at(const uword, const uword in_col)
+  {
+  return access::rw( Mat<eT>::mem[in_col] );
+  }
+
+
+
+template<typename eT>
+arma_inline
+arma_warn_unused
+eT
+Row<eT>::at(const uword, const uword in_col) const
+  {
+  return Mat<eT>::mem[in_col];
+  }
+
+
+
+template<typename eT>
 inline
 typename Row<eT>::row_iterator
 Row<eT>::begin_row(const uword row_num)
@@ -1014,7 +1058,7 @@
 arma_inline
 arma_warn_unused
 eT&
-Row<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col)
+Row<eT>::fixed<fixed_n_elem>::at(const uword, const uword in_col)
   {
   return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col];
   }
@@ -1026,7 +1070,7 @@
 arma_inline
 arma_warn_unused
 eT
-Row<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) const
+Row<eT>::fixed<fixed_n_elem>::at(const uword, const uword in_col) const
   {
   return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col];
   }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2011 Conrad Sanderson
+// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2012 Conrad Sanderson
 // 
 // This file is part of the Armadillo C++ library.
 // It is provided without any warranty of fitness
@@ -65,10 +65,26 @@
     const eT val = data[i];
     
     if(
-      val >= eT(+100) ||
-      ( (is_signed<eT>::value == true) && (val <= eT(-100)) ) ||
-      ( (is_non_integral<eT>::value == true) && (val > eT(0)) && (val <= eT(+1e-4)) ) ||
-      ( (is_non_integral<eT>::value == true) && (is_signed<eT>::value == true) && (val < eT(0)) && (val >= eT(-1e-4)) ) 
+      ( val >= eT(+100) )
+      ||
+      //( (is_signed<eT>::value == true) && (val <= eT(-100)) ) ||
+      //( (is_non_integral<eT>::value == true) && (val > eT(0)) && (val <= eT(+1e-4)) ) ||
+      //( (is_non_integral<eT>::value == true) && (is_signed<eT>::value == true) && (val < eT(0)) && (val >= eT(-1e-4)) ) 
+        (
+        cond_rel< is_signed<eT>::value >::leq(val, eT(-100))
+        )
+      ||
+        (
+        cond_rel< is_non_integral<eT>::value >::gt(val,  eT(0))
+        &&
+        cond_rel< is_non_integral<eT>::value >::leq(val, eT(+1e-4))
+        )
+      ||
+        (
+        cond_rel< is_non_integral<eT>::value && is_signed<eT>::value >::lt(val, eT(0))
+        &&
+        cond_rel< is_non_integral<eT>::value && is_signed<eT>::value >::geq(val, eT(-1e-4))
+        )
       )
       {
       use_layout_C = true;
@@ -76,7 +92,8 @@
       }
       
     if(
-      (val >= eT(+10)) || ( (is_signed<eT>::value == true) && (val <= eT(-10)) )
+      // (val >= eT(+10)) || ( (is_signed<eT>::value == true) && (val <= eT(-10)) )
+      (val >= eT(+10)) || ( cond_rel< is_signed<eT>::value >::leq(val, eT(-10)) )
       )
       {
       use_layout_B = true;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -18,8 +18,8 @@
 
 #define ARMA_VERSION_MAJOR 2
 #define ARMA_VERSION_MINOR 99
-#define ARMA_VERSION_PATCH 1
-#define ARMA_VERSION_NAME  "Antarctic Chilli Ranch (Beta 1)"
+#define ARMA_VERSION_PATCH 2
+#define ARMA_VERSION_NAME  "Antarctic Chilli Ranch (Beta 2)"
 
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -195,13 +195,27 @@
     const in_eT tmp_i = src[i];
     const in_eT tmp_j = src[j];
     
-    dest[i] = out_eT( tmp_i );
-    dest[j] = out_eT( tmp_j );
+    // dest[i] = out_eT( tmp_i );
+    // dest[j] = out_eT( tmp_j );
+    
+    dest[i] = (is_signed<out_eT>::value)
+              ? out_eT( tmp_i )
+              : ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) );
+              
+    dest[j] = (is_signed<out_eT>::value)
+              ? out_eT( tmp_j )
+              : ( cond_rel< is_signed<in_eT>::value >::lt(tmp_j, in_eT(0)) ? out_eT(0) : out_eT(tmp_j) );
     }
   
   if(i < n_elem)
     {
-    dest[i] = out_eT( src[i] );
+    const in_eT tmp_i = src[i];
+    
+    // dest[i] = out_eT( tmp_i );
+    
+    dest[i] = (is_signed<out_eT>::value)
+              ? out_eT( tmp_i )
+              : ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) );
     }
   }
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -918,6 +918,8 @@
     }
   #else
     {
+    arma_ignore(X);
+    
     out_val  = eT(0);
     out_sign =  T(0);
     
@@ -1166,7 +1168,7 @@
     char uplo  = 'U';
     
     blas_int n_rows = A.n_rows;
-    blas_int lwork  = (std::max)(blas_int(1), 3*n_rows-1);
+    blas_int lwork  = (std::max)(blas_int(1), 3*n_rows-1) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
     
     eigval.set_size( static_cast<uword>(n_rows) );
     podarray<eT> work( static_cast<uword>(lwork) );
@@ -1216,11 +1218,12 @@
     
     blas_int n_rows = A.n_rows;
     blas_int lda    = A.n_rows;
-    blas_int lwork  = (std::max)(blas_int(1), 2*n_rows - 1);  // TODO: automatically find best size of lwork
+    blas_int lwork  = (std::max)(blas_int(1), 2*n_rows - 1) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
+    // TODO: automatically find best size of lwork
     
     eigval.set_size( static_cast<uword>(n_rows) );
     
-    podarray<eT> work( static_cast<uword>(lwork) );
+    podarray<eT>  work( static_cast<uword>(lwork) );
     podarray<T>  rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) );
     
     blas_int info;
@@ -1270,7 +1273,7 @@
     char uplo  = 'U';
     
     blas_int n_rows = eigvec.n_rows;
-    blas_int lwork  = (std::max)(blas_int(1), 3*n_rows-1);
+    blas_int lwork  = (std::max)(blas_int(1), 3*n_rows-1) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
     
     eigval.set_size( static_cast<uword>(n_rows) );
     podarray<eT> work( static_cast<uword>(lwork) );
@@ -1286,6 +1289,8 @@
     {
     arma_ignore(eigval);
     arma_ignore(eigvec);
+    arma_ignore(X);
+    
     arma_stop("eig_sym(): use of LAPACK needs to be enabled");
     
     return false;
@@ -1323,7 +1328,8 @@
     
     blas_int n_rows = eigvec.n_rows;
     blas_int lda    = eigvec.n_rows;
-    blas_int lwork  = (std::max)(blas_int(1), 2*n_rows - 1);  // TODO: automatically find best size of lwork
+    blas_int lwork  = (std::max)(blas_int(1), 2*n_rows - 1) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
+    // TODO: automatically find best size of lwork
     
     eigval.set_size( static_cast<uword>(n_rows) );
     
@@ -1414,13 +1420,14 @@
     
     blas_int n_rows = A_n_rows;
     blas_int lda    = A_n_rows;
-    blas_int lwork  = (std::max)(blas_int(1), 4*n_rows);  // TODO: automatically find best size of lwork
+    blas_int lwork  = (std::max)(blas_int(1), 4*n_rows) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
+    // TODO: automatically find best size of lwork
     
     eigval.set_size(A_n_rows);
     l_eigvec.set_size(A_n_rows, A_n_rows);
     r_eigvec.set_size(A_n_rows, A_n_rows);
     
-    podarray<T> work( static_cast<uword>(lwork) );
+    podarray<T>  work( static_cast<uword>(lwork) );
     podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows)) );
     
     podarray<T> wr(A_n_rows);
@@ -1524,7 +1531,8 @@
        
     blas_int n_rows = A_n_rows;
     blas_int lda    = A_n_rows;
-    blas_int lwork  = (std::max)(blas_int(1), 4*n_rows);  // TODO: automatically find best size of lwork
+    blas_int lwork  = (std::max)(blas_int(1), 4*n_rows) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
+    // TODO: automatically find best size of lwork
     
     eigval.set_size(A_n_rows);
     l_eigvec.set_size(A_n_rows, A_n_rows);
@@ -1596,6 +1604,8 @@
   #else
     {
     arma_ignore(out);
+    arma_ignore(X);
+    
     arma_stop("chol(): use of LAPACK needs to be enabled");
     return false;
     }
@@ -2443,26 +2453,26 @@
       {
       #if defined(ARMA_USE_ATLAS)
         {
-        podarray<int> ipiv(A_n_rows);
-        
         out = B;
         
+        podarray<int> ipiv(A_n_rows + 2);  // +2 for paranoia: old versions of Atlas might be trashing memory
+        
         int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B.n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows);
         
         return (info == 0);
         }
       #elif defined(ARMA_USE_LAPACK)
         {
-        blas_int n    = A_n_rows;
+        blas_int n    = A_n_rows;  // assuming A is square
         blas_int lda  = A_n_rows;
         blas_int ldb  = A_n_rows;
         blas_int nrhs = B.n_cols;
         blas_int info;
         
-        podarray<blas_int> ipiv(A_n_rows);
-        
         out = B;
         
+        podarray<blas_int> ipiv(A_n_rows + 2);  // +2 for paranoia: some versions of Lapack might be trashing memory
+        
         lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info);
         
         return (info == 0);
@@ -2505,7 +2515,7 @@
     blas_int  lda   = A.n_rows;
     blas_int  ldb   = A.n_rows;
     blas_int  nrhs  = B.n_cols;
-    blas_int  lwork = n + (std::max)(n, nrhs);
+    blas_int  lwork = n + (std::max)(n, nrhs) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
     blas_int  info;
     
     Mat<eT> tmp = B;
@@ -2573,7 +2583,7 @@
     blas_int  lda   = A.n_rows;
     blas_int  ldb   = A.n_cols;
     blas_int  nrhs  = B.n_cols;
-    blas_int  lwork = m + (std::max)(m,nrhs);
+    blas_int  lwork = m + (std::max)(m,nrhs) + 2;  // +2 for paranoia: some versions of Lapack might be trashing memory
     blas_int  info;
     
     
@@ -2726,6 +2736,8 @@
     {
     arma_ignore(Z);
     arma_ignore(T);
+    arma_ignore(A);
+    
     arma_stop("schur_dec(): use of LAPACK needs to be enabled");
     return false;
     }
@@ -2783,6 +2795,8 @@
     {
     arma_ignore(Z);
     arma_ignore(T);
+    arma_ignore(A);
+    
     arma_stop("schur_dec(): use of LAPACK needs to be enabled");
     return false;
     }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp	2012-03-24 18:23:44 UTC (rev 3554)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -100,7 +100,7 @@
   
   #if defined(__clang__)
     #undef ARMA_HAVE_STD_TR1
-    #undef ARMA_GOOD_COMPILER
+    //#undef ARMA_GOOD_COMPILER
   #endif
   
   #if (ARMA_GCC_VERSION >= 40300)

Added: pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_bones.hpp	                        (rev 0)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_bones.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -0,0 +1,35 @@
+// Copyright (C) 2012 NICTA (www.nicta.com.au)
+// Copyright (C) 2012 Conrad Sanderson
+// 
+// This file is part of the Armadillo C++ library.
+// It is provided without any warranty of fitness
+// for any purpose. You can redistribute this file
+// and/or modify it under the terms of the GNU
+// Lesser General Public License (LGPL) as published
+// by the Free Software Foundation, either version 3
+// of the License or (at your option) any later version.
+// (see http://www.opensource.org/licenses for more info)
+
+
+//! \addtogroup cond_rel
+//! @{
+
+
+//
+// for preventing pedantic compiler warnings
+
+template<const bool do_eval>
+class cond_rel
+  {
+  public:
+  
+  template<typename eT> arma_inline static bool lt(const eT A, const eT B);
+  template<typename eT> arma_inline static bool gt(const eT A, const eT B);
+
+  template<typename eT> arma_inline static bool leq(const eT A, const eT B);
+  template<typename eT> arma_inline static bool geq(const eT A, const eT B);
+  };
+
+
+
+//! @}

Added: pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_meat.hpp	                        (rev 0)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/cond_rel_meat.hpp	2012-03-28 16:01:49 UTC (rev 3555)
@@ -0,0 +1,107 @@
+// Copyright (C) 2012 NICTA (www.nicta.com.au)
+// Copyright (C) 2012 Conrad Sanderson
+// 
+// This file is part of the Armadillo C++ library.
+// It is provided without any warranty of fitness
+// for any purpose. You can redistribute this file
+// and/or modify it under the terms of the GNU
+// Lesser General Public License (LGPL) as published
+// by the Free Software Foundation, either version 3
[TRUNCATED]

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


More information about the Rcpp-commits mailing list