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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 6 12:14:08 CEST 2011


Author: edd
Date: 2011-06-06 12:14:07 +0200 (Mon, 06 Jun 2011)
New Revision: 3044

Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/NEWS
   pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp
Log:
Release 0.2.2 using RcppArmadillo 1.99.4


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/ChangeLog	2011-06-06 10:14:07 UTC (rev 3044)
@@ -1,3 +1,9 @@
+2011-06-06  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.2.22
+
+	* inst/include/*: Updated to release 1.99.4 of Armadillo
+
 2011-05-30  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/RcppArmadilloConfig.h: Enable sprintf on FreeBSD by

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/DESCRIPTION	2011-06-06 10:14:07 UTC (rev 3044)
@@ -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 1.99.2). Thus users do not need to
+ Armadillo library (currently version 1.99.4). 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	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/NEWS	2011-06-06 10:14:07 UTC (rev 3044)
@@ -1,3 +1,9 @@
+0.2.22  2011-06-06
+
+    o   Upgraded to Armadillo release 1.99.3 "v2.0 beta 3" 
+
+          * fixes for handling of tiny matrices
+
 0.2.21  2011-05-27
 
     o   Upgraded to Armadillo release 1.99.3 "v2.0 beta 3" 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -85,7 +85,7 @@
     }
   
   arma_inline u32 get_n_rows() const { return Q.n_rows; }
-  arma_inline u32 get_n_cols() const { return Q.n_cols; }
+  arma_inline u32 get_n_cols() const { return 1;        }
   arma_inline u32 get_n_elem() const { return Q.n_elem; }
   
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
@@ -117,7 +117,7 @@
     arma_extra_debug_sigprint();
     }
   
-  arma_inline u32 get_n_rows() const { return Q.n_rows; }
+  arma_inline u32 get_n_rows() const { return 1;        }
   arma_inline u32 get_n_cols() const { return Q.n_cols; }
   arma_inline u32 get_n_elem() const { return Q.n_elem; }
   
@@ -250,7 +250,7 @@
     }
   
   arma_inline u32 get_n_rows() const { return Q.n_rows; }
-  arma_inline u32 get_n_cols() const { return Q.n_cols; }
+  arma_inline u32 get_n_cols() const { return 1;        }
   arma_inline u32 get_n_elem() const { return Q.n_elem; }
   
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }
@@ -283,7 +283,7 @@
     }
   
   arma_inline u32 get_n_rows() const { return Q.n_rows; }
-  arma_inline u32 get_n_cols() const { return Q.n_cols; }
+  arma_inline u32 get_n_cols() const { return 1;        }
   arma_inline u32 get_n_elem() const { return Q.n_elem; }
   
   arma_inline elem_type operator[] (const u32 i)                  const { return Q[i];           }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -18,8 +18,8 @@
 
 #define ARMA_VERSION_MAJOR 1
 #define ARMA_VERSION_MINOR 99
-#define ARMA_VERSION_PATCH 3
-#define ARMA_VERSION_NAME  "v2.0 beta 3"
+#define ARMA_VERSION_PATCH 4
+#define ARMA_VERSION_NAME  "v2.0 beta 4"
 
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -36,10 +36,10 @@
   // inv
   
   template<typename eT, typename T1>
-  inline static bool inv(Mat<eT>& out, const Base<eT,T1>& X);
+  inline static bool inv(Mat<eT>& out, const Base<eT,T1>& X, const bool slow = false);
   
   template<typename eT>
-  inline static bool inv(Mat<eT>& out, const Mat<eT>& A);
+  inline static bool inv(Mat<eT>& out, const Mat<eT>& A, const bool slow = false);
   
   template<typename eT>
   inline static bool inv_noalias_tinymat(Mat<eT>& out, const Mat<eT>& X, const u32 N);
@@ -69,7 +69,7 @@
   // det
   
   template<typename eT, typename T1>
-  inline static eT det(const Base<eT,T1>& X);
+  inline static eT det(const Base<eT,T1>& X, const bool slow = false);
   
   template<typename eT>
   inline static eT det_tinymat(const Mat<eT>& X, const u32 N);
@@ -160,7 +160,7 @@
   // solve
   
   template<typename eT>
-  inline static bool solve   (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
+  inline static bool solve   (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow = false);
   
   template<typename eT>
   inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -22,19 +22,19 @@
 template<typename eT, typename T1>
 inline
 bool
-auxlib::inv(Mat<eT>& out, const Base<eT,T1>& X)
+auxlib::inv(Mat<eT>& out, const Base<eT,T1>& X, const bool slow)
   {
   arma_extra_debug_sigprint();
   
-  bool status = false;
-  
   out = X.get_ref();
   
   arma_debug_check( (out.is_square() == false), "inv(): given matrix is not square" );
   
+  bool status = false;
+  
   const u32 N = out.n_rows;
   
-  if(N <= 4)
+  if( (N <= 4) && (slow == false) )
     {
     status = auxlib::inv_inplace_tinymat(out, N);
     }
@@ -58,7 +58,7 @@
 template<typename eT>
 inline
 bool
-auxlib::inv(Mat<eT>& out, const Mat<eT>& X)
+auxlib::inv(Mat<eT>& out, const Mat<eT>& X, const bool slow)
   {
   arma_extra_debug_sigprint();
   
@@ -68,7 +68,7 @@
   
   const u32 N = X.n_rows;
   
-  if(N <= 4)
+  if( (N <= 4) && (slow == false) )
     {
     status = (&out != &X) ? auxlib::inv_noalias_tinymat(out, X, N) : auxlib::inv_inplace_tinymat(out, N);
     }
@@ -424,7 +424,7 @@
   #else
     {
     arma_ignore(out);
-    arma_stop("inv(): use of ATLAS or LAPACK needs to enabled");
+    arma_stop("inv(): use of ATLAS or LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -464,7 +464,7 @@
   #else
     {
     arma_ignore(layout);
-    arma_stop("inv(): use of LAPACK needs to enabled");
+    arma_stop("inv(): use of LAPACK needs to be enabled");
     status = false;
     }
   #endif
@@ -528,7 +528,7 @@
   #else
     {
     arma_ignore(layout);
-    arma_stop("inv(): use of LAPACK needs to enabled");
+    arma_stop("inv(): use of LAPACK needs to be enabled");
     status = false;
     }
   #endif
@@ -547,38 +547,43 @@
 template<typename eT, typename T1>
 inline
 eT
-auxlib::det(const Base<eT,T1>& X)
+auxlib::det(const Base<eT,T1>& X, const bool slow)
   {
   const unwrap<T1>   tmp(X.get_ref());
   const Mat<eT>& A = tmp.M;
   
-  arma_debug_check( !A.is_square(), "det(): matrix is not square" );
+  arma_debug_check( (A.is_square() == false), "det(): matrix is not square" );
   
   const bool make_copy = (is_Mat<T1>::value == true) ? true : false;
   
-  const u32 N = A.n_rows;
-  
-  switch(N)
+  if(slow == false)
     {
-    case 0:
-    case 1:
-    case 2:
-      return auxlib::det_tinymat(A, N);
-      break;
+    const u32 N = A.n_rows;
     
-    case 3:
-    case 4:
+    switch(N)
       {
-      const eT tmp_det = auxlib::det_tinymat(A, N);
-      return (tmp_det != eT(0)) ? tmp_det : auxlib::det_lapack(A, make_copy);
+      case 0:
+      case 1:
+      case 2:
+        return auxlib::det_tinymat(A, N);
+        break;
+      
+      case 3:
+      case 4:
+        {
+        const eT tmp_det = auxlib::det_tinymat(A, N);
+        return (tmp_det != eT(0)) ? tmp_det : auxlib::det_lapack(A, make_copy);
+        }
+        break;
+      
+      default:
+        return auxlib::det_lapack(A, make_copy);
       }
-      break;
-    
-    default:
-      return auxlib::det_lapack(A, make_copy);
     }
-  
-  return eT(0);  // prevent compiler warnings
+  else
+    {
+    return auxlib::det_lapack(A, make_copy);
+    }
   }
 
 
@@ -697,6 +702,12 @@
   
   Mat<eT>& tmp = (make_copy == true) ? X_copy : const_cast< Mat<eT>& >(X);
   
+  if(tmp.is_empty())
+    {
+    return eT(1);
+    }
+  
+  
   #if defined(ARMA_USE_ATLAS)
     {
     podarray<int> ipiv(tmp.n_rows);
@@ -754,7 +765,7 @@
     arma_ignore(X);
     arma_ignore(make_copy);
     arma_ignore(tmp);
-    arma_stop("det(): use of ATLAS or LAPACK needs to enabled");
+    arma_stop("det(): use of ATLAS or LAPACK needs to be enabled");
     return eT(0);
     }
   #endif
@@ -858,7 +869,7 @@
     }
   #else
     {
-    arma_stop("log_det(): use of ATLAS or LAPACK needs to enabled");
+    arma_stop("log_det(): use of ATLAS or LAPACK needs to be enabled");
     
     out_val  = eT(0);
     out_sign =  T(0);
@@ -940,7 +951,7 @@
     {
     arma_ignore(U_n_rows);
     arma_ignore(U_n_cols);
-    arma_stop("lu(): use of ATLAS or LAPACK needs to enabled");
+    arma_stop("lu(): use of ATLAS or LAPACK needs to be enabled");
     }
   #endif
   }
@@ -1105,7 +1116,7 @@
     {
     arma_ignore(eigval);
     arma_ignore(X);
-    arma_stop("eig_sym(): use of LAPACK needs to enabled");
+    arma_stop("eig_sym(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1157,7 +1168,7 @@
     {
     arma_ignore(eigval);
     arma_ignore(X);
-    arma_stop("eig_sym(): use of LAPACK needs to enabled");
+    arma_stop("eig_sym(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1209,7 +1220,7 @@
     {
     arma_ignore(eigval);
     arma_ignore(eigvec);
-    arma_stop("eig_sym(): use of LAPACK needs to enabled");
+    arma_stop("eig_sym(): use of LAPACK needs to be enabled");
     
     return false;
     }
@@ -1265,7 +1276,7 @@
     arma_ignore(eigval);
     arma_ignore(eigvec);
     arma_ignore(X);
-    arma_stop("eig_sym(): use of LAPACK needs to enabled");
+    arma_stop("eig_sym(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1371,7 +1382,7 @@
     arma_ignore(r_eigvec);
     arma_ignore(X);
     arma_ignore(side);
-    arma_stop("eig_gen(): use of LAPACK needs to enabled");
+    arma_stop("eig_gen(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1470,7 +1481,7 @@
     arma_ignore(r_eigvec);
     arma_ignore(X);
     arma_ignore(side);
-    arma_stop("eig_gen(): use of LAPACK needs to enabled");
+    arma_stop("eig_gen(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1519,7 +1530,7 @@
   #else
     {
     arma_ignore(out);
-    arma_stop("chol(): use of LAPACK needs to enabled");
+    arma_stop("chol(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1623,7 +1634,7 @@
     arma_ignore(Q);
     arma_ignore(R);
     arma_ignore(X);
-    arma_stop("qr(): use of LAPACK needs to enabled");
+    arma_stop("qr(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1718,7 +1729,7 @@
     arma_ignore(X);
     arma_ignore(X_n_rows);
     arma_ignore(X_n_cols);
-    arma_stop("svd(): use of LAPACK needs to enabled");
+    arma_stop("svd(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1817,7 +1828,7 @@
     arma_ignore(X_n_rows);
     arma_ignore(X_n_cols);
 
-    arma_stop("svd(): use of LAPACK needs to enabled");
+    arma_stop("svd(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -1935,7 +1946,7 @@
     arma_ignore(S);
     arma_ignore(V);
     arma_ignore(X);
-    arma_stop("svd(): use of LAPACK needs to enabled");
+    arma_stop("svd(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -2031,7 +2042,7 @@
     arma_ignore(S);
     arma_ignore(V);
     arma_ignore(X);
-    arma_stop("svd(): use of LAPACK needs to enabled");
+    arma_stop("svd(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -2045,7 +2056,7 @@
 template<typename eT>
 inline
 bool
-auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B)
+auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow)
   {
   arma_extra_debug_sigprint();
   
@@ -2061,7 +2072,7 @@
     
     bool status = false;
     
-    if(A_n_rows <= 4)
+    if( (A_n_rows <= 4) && (slow == false) )
       {
       Mat<eT> A_inv;
       
@@ -2097,7 +2108,7 @@
         }
       #else
         {
-        arma_stop("solve(): use of LAPACK needs to enabled");
+        arma_stop("solve(): use of LAPACK needs to be enabled");
         return false;
         }
       #endif
@@ -2170,7 +2181,7 @@
     arma_ignore(out);
     arma_ignore(A);
     arma_ignore(B);
-    arma_stop("solve(): use of LAPACK needs to enabled");
+    arma_stop("solve(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -2253,7 +2264,7 @@
     arma_ignore(out);
     arma_ignore(A);
     arma_ignore(B);
-    arma_stop("solve(): use of LAPACK needs to enabled");
+    arma_stop("solve(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif
@@ -2298,7 +2309,7 @@
     arma_ignore(A);
     arma_ignore(B);
     arma_ignore(layout);
-    arma_stop("solve(): use of LAPACK needs to enabled");
+    arma_stop("solve(): use of LAPACK needs to be enabled");
     return false;
     }
   #endif

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -21,13 +21,18 @@
 inline
 arma_warn_unused
 typename T1::elem_type
-det(const Base<typename T1::elem_type,T1>& X, const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0)
+det
+  (
+  const Base<typename T1::elem_type,T1>& X,
+  const bool slow = false,
+  const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
+  )
   {
   arma_extra_debug_sigprint();
   
   arma_ignore(junk);
   
-  return auxlib::det(X);
+  return auxlib::det(X, slow);
   }
 
 
@@ -37,9 +42,14 @@
 inline
 arma_warn_unused
 typename T1::elem_type
-det(const Op<T1, op_diagmat>& X)
+det
+  (
+  const Op<T1, op_diagmat>& X,
+  const bool slow = false
+  )
   {
   arma_extra_debug_sigprint();
+  arma_ignore(slow);
   
   typedef typename T1::elem_type eT;
   
@@ -47,14 +57,9 @@
   
   const u32 A_n_elem = A.n_elem;
   
-  if(A_n_elem == 0)
-    {
-    return eT(1);
-    }
+  eT val = eT(1);
   
-  eT val = A[0];
-  
-  for(u32 i=1; i<A_n_elem; ++i)
+  for(u32 i=0; i<A_n_elem; ++i)
     {
     val *= A[i];
     }
@@ -69,15 +74,19 @@
 inline
 arma_warn_unused
 typename T1::elem_type
-det(const Op<T1,op_inv>& in, const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0)
+det
+  (
+  const Op<T1,op_inv>& in,
+  const bool slow = false,
+  const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
+  )
   {
   arma_extra_debug_sigprint();
-  
   arma_ignore(junk);
   
   typedef typename T1::elem_type eT;
   
-  eT tmp = det(in.m);
+  eT tmp = det(in.m, slow);
   arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" );
   
   return eT(1) / tmp;
@@ -90,18 +99,21 @@
 inline
 arma_warn_unused
 typename T1::elem_type
-det(const Op<T1,op_htrans>& in, const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0)
+det
+  (
+  const Op<T1,op_htrans>& in,
+  const bool slow = false,
+  const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0)
   {
   arma_extra_debug_sigprint();
-  
   arma_ignore(junk);
   
   typedef typename T1::elem_type eT;
   
   const unwrap<T1>   tmp(in.m);
   const Mat<eT>& X = tmp.M;
-
-  return det(X);
+  
+  return det(X, slow);
   }
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2010 Conrad Sanderson
+// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2011 Conrad Sanderson
 // 
 // This file is part of the Armadillo C++ library.
 // It is provided without any warranty of fitness
@@ -23,13 +23,14 @@
 inv
   (
   const Base<typename T1::elem_type,T1>& X,
+  const bool slow = false,
   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
   )
   {
   arma_extra_debug_sigprint();
   arma_ignore(junk);
   
-  return Op<T1, op_inv>(X.get_ref());
+  return Op<T1, op_inv>(X.get_ref(), ((slow == false) ? 0 : 1), 0);
   }
 
 
@@ -38,9 +39,10 @@
 template<typename T1>
 arma_inline
 const T1&
-inv(const Op<T1, op_inv>& X)
+inv(const Op<T1, op_inv>& X, const bool slow = false)
   {
   arma_extra_debug_sigprint();
+  arma_ignore(slow);
   
   return X.m;
   }
@@ -54,10 +56,12 @@
 inv
   (
   const Op<T1, op_trimat>& X,
+  const bool slow = false,
   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
   )
   {
   arma_extra_debug_sigprint();
+  arma_ignore(slow);
   arma_ignore(junk);
   
   return Op<T1, op_inv_tr>(X.m, X.aux_u32_a, 0);
@@ -72,10 +76,12 @@
 inv
   (
   const Op<T1, op_symmat>& X,
+  const bool slow = false,
   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
   )
   {
   arma_extra_debug_sigprint();
+  arma_ignore(slow);
   arma_ignore(junk);
   
   return Op<T1, op_inv_sym>(X.m, X.aux_u32_a, 0);

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -1,5 +1,5 @@
-// Copyright (C) 2009-2010 NICTA (www.nicta.com.au)
-// Copyright (C) 2009-2010 Conrad Sanderson
+// Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
+// Copyright (C) 2009-2011 Conrad Sanderson
 // 
 // This file is part of the Armadillo C++ library.
 // It is provided without any warranty of fitness
@@ -31,13 +31,14 @@
   (
   const Base<typename T1::elem_type,T1>& A,
   const Base<typename T1::elem_type,T2>& B,
+  const bool slow = false,
   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
   )
   {
   arma_extra_debug_sigprint();
   arma_ignore(junk);
   
-  return Glue<T1, T2, glue_solve>(A.get_ref(), B.get_ref());
+  return Glue<T1, T2, glue_solve>(A.get_ref(), B.get_ref(), ((slow == false) ? 0 : 1) );
   }
 
 
@@ -49,10 +50,12 @@
   (
   const Op<T1, op_trimat>& A,
   const Base<typename T1::elem_type,T2>& B,
+  const bool slow = false,
   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
   )
   {
   arma_extra_debug_sigprint();
+  arma_ignore(slow);
   arma_ignore(junk);
   
   return Glue<T1, T2, glue_solve_tr>(A.m, B.get_ref(), A.aux_u32_a);
@@ -68,13 +71,14 @@
   Mat<typename T1::elem_type>& out,
   const Base<typename T1::elem_type,T1>& A,
   const Base<typename T1::elem_type,T2>& B,
+  const bool slow = false,
   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
   )
   {
   arma_extra_debug_sigprint();
   arma_ignore(junk);
   
-  out = solve( A.get_ref(), B.get_ref() );
+  out = solve( A.get_ref(), B.get_ref(), slow );
   
   return (out.n_elem == 0) ? false : true;
   }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -29,6 +29,19 @@
 
 
 
+template<typename T1>
+arma_inline
+const Op<T1, op_htrans>
+strans(const Base<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = 0)
+  {
+  arma_extra_debug_sigprint();
+  arma_ignore(junk);
+  
+  return Op<T1, op_htrans>(X.get_ref());
+  }
+
+
+
 //! two consecutive transpose operations cancel each other
 template<typename T1>
 arma_inline

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -16,7 +16,7 @@
 
 
 
-//! for small square matrices with n_rows <= 4
+//! for tiny square matrices, size <= 4x4
 template<const bool do_trans_A=false, const bool use_alpha=false, const bool use_beta=false>
 class gemm_emul_tinysq
   {
@@ -42,22 +42,22 @@
     switch(A.n_rows)
       {
       case 4:
-        gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(3), A, B.colptr(3), alpha, beta );
+        gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr(3), A, B.colptr(3), alpha, beta );
         
       case 3:
-        gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(2), A, B.colptr(2), alpha, beta );
+        gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr(2), A, B.colptr(2), alpha, beta );
         
       case 2:
-        gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(1), A, B.colptr(1), alpha, beta );
+        gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr(1), A, B.colptr(1), alpha, beta );
         
       case 1:
-        gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(0), A, B.colptr(0), alpha, beta );
+        gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr(0), A, B.colptr(0), alpha, beta );
         
       default:
         ;
       }
     }
-
+  
   };
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -16,9 +16,9 @@
 
 
 
-//! for tiny square matrices with n_rows <= 4
+//! for tiny square matrices, size <= 4x4
 template<const bool do_trans_A=false, const bool use_alpha=false, const bool use_beta=false>
-class gemv_emul_tiny
+class gemv_emul_tinysq
   {
   public:
   
@@ -159,6 +159,31 @@
     
     if(do_trans_A == false)
       {
+      if(A_n_rows == 1)
+        {
+        const eT acc = op_dot::direct_dot_arma(A_n_cols, A.mem, x);
+        
+        if( (use_alpha == false) && (use_beta == false) )
+          {
+          y[0] = acc;
+          }
+        else
+        if( (use_alpha == true) && (use_beta == false) )
+          {
+          y[0] = alpha * acc;
+          }
+        else
+        if( (use_alpha == false) && (use_beta == true) )
+          {
+          y[0] = acc + beta*y[0];
+          }
+        else
+        if( (use_alpha == true) && (use_beta == true) )
+          {
+          y[0] = alpha*acc + beta*y[0];
+          }
+        }
+      else
       for(u32 row=0; row < A_n_rows; ++row)
         {
         eT acc = eT(0);
@@ -250,13 +275,16 @@
     arma_extra_debug_sigprint();
     arma_ignore(junk);
     
-    if( A.n_rows > 4 )
+    const u32 A_n_rows = A.n_rows;
+    const u32 A_n_cols = A.n_cols;
+    
+    if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) )
       {
-      gemv_emul_large<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alpha, beta);
+      gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alpha, beta);
       }
     else
       {
-      gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alpha, beta);
+      gemv_emul_large<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alpha, beta);
       }
     }
   
@@ -280,13 +308,16 @@
     
     const Mat<eT>& AA = (do_trans_A == false) ? A : tmp_A;
     
-    if( AA.n_rows > 4 )
+    const u32 AA_n_rows = AA.n_rows;
+    const u32 AA_n_cols = AA.n_cols;
+    
+    if( (AA_n_rows <= 4) && (AA_n_rows == AA_n_cols) )
       {
-      gemv_emul_large<false, use_alpha, use_beta>::apply(y, AA, x, alpha, beta);
+      gemv_emul_tinysq<false, use_alpha, use_beta>::apply(y, AA, x, alpha, beta);
       }
     else
       {
-      gemv_emul_tiny<false, use_alpha, use_beta>::apply(y, AA, x, alpha, beta);
+      gemv_emul_large<false, use_alpha, use_beta>::apply(y, AA, x, alpha, beta);
       }
     }
   };

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -36,7 +36,16 @@
   
   if(A.n_rows == A.n_cols)
     {
-    status = auxlib::solve(out, A, B);
+    const u32 mode = X.aux_u32;
+    
+    if(mode == 0)
+      {
+      status = auxlib::solve(out, A, B);
+      }
+    else
+      {
+      status = auxlib::solve(out, A, B, true);
+      }
     }
   else
   if(A.n_rows > A.n_cols)
@@ -74,10 +83,15 @@
   const Mat<eT>& A = A_tmp.M;
   const Mat<eT>& B = B_tmp.M;
   
-  arma_debug_check( ( (&A) == (&B) ),         "solve(): A is an alias of B" );
-  arma_debug_check( (A.n_rows != B.n_rows),   "solve(): number of rows in A and B must be the same" );
-  arma_debug_check( (A.is_square() == false), "solve(): A is not a square matrix" );
+  bool  err_state = false;
+  char* err_msg   = 0;
   
+  arma_debug_set_error( err_state, err_msg, ((&A) == (&B)),           "solve(): A is an alias of B" );
+  arma_debug_set_error( err_state, err_msg, (A.n_rows != B.n_rows),   "solve(): number of rows in A and B must be the same" );
+  arma_debug_set_error( err_state, err_msg, (A.is_square() == false), "solve(): A is not a square matrix" );
+  
+  arma_debug_check(err_state, err_msg);
+  
   const bool status = auxlib::solve_tr(out, A, B, X.aux_u32);
   
   if(status == false)

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2010 Conrad Sanderson
+// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2011 Conrad Sanderson
 // 
 // This file is part of the Armadillo C++ library.
 // It is provided without any warranty of fitness
@@ -22,14 +22,13 @@
   public:
   
   template<typename eT>
-  inline static void apply(Mat<eT>& out, const Mat<eT>& A);
+  inline static void apply(Mat<eT>& out, const Mat<eT>& A, const bool slow = false);
   
   template<typename T1>
   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_inv>& in);
-
+  
   template<typename T1>
   inline static void apply_diag(Mat<typename T1::elem_type>& out, const Base<typename T1::elem_type, T1>& X);
-
   };
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2010 Conrad Sanderson
+// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2011 Conrad Sanderson
 // 
 // This file is part of the Armadillo C++ library.
 // It is provided without any warranty of fitness
@@ -19,7 +19,7 @@
 template<typename eT>
 inline
 void
-op_inv::apply(Mat<eT>& out, const Mat<eT>& A)
+op_inv::apply(Mat<eT>& out, const Mat<eT>& A, const bool slow)
   {
   arma_extra_debug_sigprint();
   
@@ -27,7 +27,7 @@
   // - auxlib::inv() copies A to out before inversion
   // - for 2x2 and 3x3 matrices the code is alias safe
   
-  auxlib::inv(out, A);
+  auxlib::inv(out, A, slow);
   }
 
 
@@ -50,7 +50,16 @@
     }
   else
     {
-    auxlib::inv(out, X.m);
+    const u32 mode = X.aux_u32_a;
+    
+    if(mode == 0)
+      {
+      auxlib::inv(out, X.m);
+      }
+    else
+      {
+      auxlib::inv(out, X.m, true);
+      }
     }
   }
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -33,12 +33,9 @@
   inline static void apply_noalias_tinysq(Mat<eT>& out, const Mat<eT>& A);
   
   template<typename eT>
-  inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arma_not_cx<eT>::result* junk = 0);
+  inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A);
   
   template<typename eT>
-  inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arma_cx_only<eT>::result* junk = 0);
-  
-  template<typename eT>
   inline static void apply(Mat<eT>& out, const Mat<eT>& A);
   
   template<typename T1>

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -95,10 +95,9 @@
 template<typename eT>
 inline
 void
-op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arma_not_cx<eT>::result* junk)
+op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A)
   {
   arma_extra_debug_sigprint();
-  arma_ignore(junk);
   
   const u32 A_n_cols = A.n_cols;
   const u32 A_n_rows = A.n_rows;
@@ -133,44 +132,9 @@
 
 
 
-//! Immediate transpose of a dense matrix
 template<typename eT>
 inline
 void
-op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arma_cx_only<eT>::result* junk)
-  {
-  arma_extra_debug_sigprint();
-  arma_ignore(junk);
-  
-  const u32 A_n_cols = A.n_cols;
-  const u32 A_n_rows = A.n_rows;
-  
-  out.set_size(A_n_cols, A_n_rows);
-  
-  if( (A_n_cols == 1) || (A_n_rows == 1) )
-    {
-    arrayops::copy( out.memptr(), A.mem, A.n_elem );
-    }
-  else
-    {
-    for(u32 in_row = 0; in_row<A_n_rows; ++in_row)
-      {
-      const u32 out_col = in_row;
-      
-      for(u32 in_col = 0; in_col<A_n_cols; ++in_col)
-        {
-        const u32 out_row = in_col;
-        out.at(out_row, out_col) = A.at(in_row, in_col);
-        }
-      }
-    }
-  }
-
-
-
-template<typename eT>
-inline
-void
 op_strans::apply(Mat<eT>& out, const Mat<eT>& A)
   {
   arma_extra_debug_sigprint();

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp	2011-05-31 08:17:13 UTC (rev 3043)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp	2011-06-06 10:14:07 UTC (rev 3044)
@@ -585,7 +585,7 @@
   Mat<eT>* tmp_out = alias ? new Mat<eT>() : 0;
   Mat<eT>& out     = alias ? *tmp_out      : actual_out;
   
-  out.set_size(aa_n_elem);
+  out.set_size(aa_n_elem, 1);
   
   eT* out_mem = out.memptr();
   



More information about the Rcpp-commits mailing list