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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 11 16:47:37 CET 2010


Author: edd
Date: 2010-11-11 16:47:37 +0100 (Thu, 11 Nov 2010)
New Revision: 2427

Removed:
   pkg/RcppArmadillo/inst/include/armadillo_bits/dgemm_proto.hpp.orig
Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/NEWS
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/blas_proto.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp
Log:
Release 0.2.9 with Armadillo 0.9.92


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/ChangeLog	2010-11-11 15:47:37 UTC (rev 2427)
@@ -1,3 +1,9 @@
+2010-11-11  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.2.9
+
+	* inst/include/*: Update to Armadillo 0.9.92 "Wall Street Gangster"
+
 2010-10-16  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.2.8

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/DESCRIPTION	2010-11-11 15:47:37 UTC (rev 2427)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.8
+Version: 0.2.9
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Romain, Dirk and Doug <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 0.9.90). Thus users do not need to
+ Armadillo library (currently version 0.9.92). 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	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/NEWS	2010-11-11 15:47:37 UTC (rev 2427)
@@ -1,3 +1,10 @@
+0.2.9   2010-11-11
+
+    o   Upgraded to Armadillo 0.9.92 "Wall Street Gangster":
+
+         * Fixes for compilation issues under the Intel C++ compiler
+         * Added matrix norms
+
 0.2.8   2010-10-16
 
     o   Upgraded to Armadillo 0.9.90 "Water Dragon":

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -2660,6 +2660,18 @@
 
 
 
+//! returns true if the matrix has no elements
+template<typename eT>
+arma_inline
+arma_warn_unused
+bool
+Mat<eT>::is_empty() const
+  {
+  return (n_elem == 0);
+  }
+
+
+
 //! returns true if the object can be interpreted as a column or row vector
 template<typename eT>
 arma_inline
@@ -2686,7 +2698,7 @@
 
 //! returns true if all of the elements are finite
 template<typename eT>
-arma_inline
+inline
 arma_warn_unused
 bool
 Mat<eT>::is_finite() const
@@ -2698,10 +2710,10 @@
   
   for(i=0, j=1; j<N; i+=2, j+=2)
     {
-    const eT ptr_i = ptr[i];
-    const eT ptr_j = ptr[j];
+    const eT val_i = ptr[i];
+    const eT val_j = ptr[j];
     
-    if( (arma_isfinite(ptr_i) == false) || (arma_isfinite(ptr_j) == false))
+    if( (arma_isfinite(val_i) == false) || (arma_isfinite(val_j) == false) )
       {
       return false;
       }
@@ -2720,18 +2732,6 @@
 
 
 
-//! returns true if the matrix has no elements
-template<typename eT>
-arma_inline
-arma_warn_unused
-bool
-Mat<eT>::is_empty() const
-  {
-  return (n_elem == 0);
-  }
-
-
-
 //! returns true if the given index is currently in range
 template<typename eT>
 arma_inline

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -222,10 +222,10 @@
   arma_inline const Mat& operator--();
   arma_inline void       operator--(int);
   
+  arma_inline arma_warn_unused bool is_empty()  const;
   arma_inline arma_warn_unused bool is_vec()    const;
   arma_inline arma_warn_unused bool is_square() const;
-  arma_inline arma_warn_unused bool is_finite() const;
-  arma_inline arma_warn_unused bool is_empty()  const;
+       inline arma_warn_unused bool is_finite() const;
   
   arma_inline arma_warn_unused bool in_range(const u32 i) const;
   arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in_col) const;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -18,11 +18,11 @@
 
 #define ARMA_VERSION_MAJOR 0
 #define ARMA_VERSION_MINOR 9
-#define ARMA_VERSION_PATCH 90
-#define ARMA_VERSION_NAME  "Water Dragon"
-// http://en.wikipedia.org/wiki/Australian_Water_Dragon
+#define ARMA_VERSION_PATCH 92
+#define ARMA_VERSION_NAME  "Wall Street Gangster"
 
 
+
 struct arma_version
   {
   static const unsigned int major = ARMA_VERSION_MAJOR;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/blas_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/blas_proto.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/blas_proto.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -20,8 +20,8 @@
   {
   extern "C"
     {
-    float  arma_fortran(sdot)(const blas_int* n, const float*  x, const blas_int* incx, const float*  y, const blas_int* incy);
-    double arma_fortran(ddot)(const blas_int* n, const double* x, const blas_int* incx, const double* y, const blas_int* incy);
+    float  arma_fortran(sdot)(blas_int* n, const float*  x, blas_int* incx, const float*  y, blas_int* incy);
+    double arma_fortran(ddot)(blas_int* n, const double* x, blas_int* incx, const double* y, blas_int* incy);
     
     void arma_fortran(sgemv)(const char* transA, const blas_int* m, const blas_int* n, const float*  alpha, const float*  A, const blas_int* ldA, const float*  x, const blas_int* incx, const float*  beta, float*  y, const blas_int* incy);
     void arma_fortran(dgemv)(const char* transA, const blas_int* m, const blas_int* n, const double* alpha, const double* A, const blas_int* ldA, const double* x, const blas_int* incx, const double* beta, double* y, const blas_int* incy);
@@ -43,33 +43,45 @@
   
   
   template<typename eT>
-  arma_inline
+  inline
   eT
-  dot(const blas_int* n, const eT* x, const eT* y)
+  dot(const u32 n_elem, const eT* x, const eT* y)
     {
-    arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
+    arma_ignore(n_elem);
+    arma_ignore(x);
+    arma_ignore(y);
     
-    const blas_int inc = 1;
+    return eT(0);
+    }
+  
+  
+  
+  template<>
+  inline
+  float
+  dot(const u32 n_elem, const float* x, const float* y)
+    {
+    blas_int n   = blas_int(n_elem);
+    blas_int inc = blas_int(1);
     
-    if(is_float<eT>::value == true)
-      {
-      typedef float T;
-      return eT( arma_fortran(sdot)(n, (const T*)x, &inc, (const T*)y, &inc) );
-      }
-    else
-    if(is_double<eT>::value == true)
-      {
-      typedef double T;
-      return eT( arma_fortran(ddot)(n, (const T*)x, &inc, (const T*)y, &inc) );
-      }
-    else
-      {
-      return eT(0);  // prevent compiler warnings
-      }
+    return arma_fortran(sdot)(&n, x, &inc, y, &inc);
     }
   
   
   
+  template<>
+  inline
+  double
+  dot(const u32 n_elem, const double* x, const double* y)
+    {
+    blas_int n   = blas_int(n_elem);
+    blas_int inc = blas_int(1);
+    
+    return arma_fortran(ddot)(&n, x, &inc, y, &inc);
+    }
+  
+  
+  
   template<typename eT>
   inline
   void

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -30,8 +30,21 @@
 #endif
 
 
-#if defined(__GNUG__)
+#if defined(__INTEL_COMPILER)
   
+  #if (__INTEL_COMPILER < 1000)
+    #error "*** Need a newer compiler ***"
+  #endif
+  
+  #define ARMA_GOOD_COMPILER
+  #undef  ARMA_HAVE_STD_TR1
+  
+  #if (__INTEL_COMPILER <= 1110)
+    #undef ARMA_HAVE_STD_ISFINITE
+  #endif
+  
+#elif defined(__GNUG__)
+  
   #if (__GNUC__ < 4)
     #error "*** Need a newer compiler ***"
   #endif
@@ -71,19 +84,6 @@
   
   #undef ARMA_GCC_VERSION
   
-#elif defined(__INTEL_COMPILER)
-  
-  #if (__INTEL_COMPILER < 1000)
-    #error "*** Need a newer compiler ***"
-  #endif
-  
-  #define ARMA_GOOD_COMPILER
-  #undef  ARMA_HAVE_STD_TR1
-  
-  #if (__INTEL_COMPILER <= 1110)
-    #undef ARMA_HAVE_STD_ISFINITE
-  #endif
-
 #endif
 
 

Deleted: pkg/RcppArmadillo/inst/include/armadillo_bits/dgemm_proto.hpp.orig
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/dgemm_proto.hpp.orig	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/dgemm_proto.hpp.orig	2010-11-11 15:47:37 UTC (rev 2427)
@@ -1,154 +0,0 @@
-// Copyright (C) 2008 NICTA
-// 
-// Author(s): Conrad Sanderson 
-// 
-// This file is part of the Armadillo Library. You can redistribute it
-// and/or modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2, 
-// or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU General Public License for more details.
-// 
-// As a special exception, if other files instantiate templates
-// or use macros or inline functions from this file, or you compile 
-// this file and link it with other files to produce an executable,
-// this file does not by itself cause the resulting executable to be
-// covered by the GNU General Public License. This exception does not
-// however invalidate any other reasons why the executable file might 
-// be covered by the GNU General Public License.
-
-
-//! \addtogroup dgemm
-//! @{
-
-
-//! wrapper for ATLAS/BLAS dgemm function, using template arguments to control the arguments passed to dgemm.
-//! If ATLAS/BLAS is not available, a partial emulation of dgemm's functionality is provided.
-template<bool do_trans_A=false, bool do_trans_B=false, bool use_alpha=false, bool use_beta=false>
-class dgemm
-  {
-  public:
-  
-  //! immediate multiplication of matrices A and B, storing the result in C
-  inline static void apply(mat& C, const mat& A, const mat& B, const double alpha = 1.0, const double beta = 0.0)
-    {
-    lowdebug_print("dgemm::apply()");
-    #if defined(ARMA_USE_ATLAS)
-      {
-      lowdebug_print("atlas::cblas_dgemm()");
-      
-      atlas::cblas_dgemm
-        (
-        atlas::CblasColMajor,
-        (do_trans_A) ? atlas::CblasTrans : atlas::CblasNoTrans,
-        (do_trans_B) ? atlas::CblasTrans : atlas::CblasNoTrans,
-        C.n_rows,
-        C.n_cols,
-        (do_trans_A) ? A.n_rows : A.n_cols,
-        (use_alpha) ? alpha : 1.0,
-        A.mem,
-        (do_trans_A) ? A.n_rows : C.n_rows,
-        B.mem,
-        (do_trans_B) ? C.n_cols : ( (do_trans_A) ? A.n_rows : A.n_cols ),
-        (use_beta) ? beta : 0.0,
-        C.memptr(),
-        C.n_rows
-        );
-      }
-    #elif defined(ARMA_USE_BLAS)
-      {
-      lowdebug_print("blas::dgemm_()");
-      
-      const char trans_A = (do_trans_A) ? 'Y' : 'N';
-      const char trans_B = (do_trans_B) ? 'Y' : 'N';
-      
-      const int m   = C.n_rows;
-      const int n   = C.n_cols;
-      const int k   = (do_trans_A) ? A.n_rows : A.n_cols;
-      
-      const double local_alpha = (use_alpha) ? alpha : 1.0;
-      
-      const int lda = (do_trans_A) ? k : m;
-      const int ldb = (do_trans_B) ? n : k;
-      
-      const double local_beta  = (use_beta) ? beta : 0.0;
-      
-      blas::dgemm_
-        (
-        &trans_A,
-        &trans_B,
-        &m,
-        &n,
-        &k,
-        &local_alpha,
-        A.mem,
-        &lda,
-        B.mem,
-        &ldb,
-        &local_beta,
-        C.memptr(),
-        &m
-        );
-      }
-    #else
-      {
-      if( (do_trans_A == false) && (do_trans_B == false) )
-        {
-        lowdebug_print("dgemm::apply(): home brewed");
-
-        quickarray<double> tmp(A.n_cols);
-        double* A_rowdata = tmp.memptr();
-        
-        for(u32 row_A=0; row_A != A.n_rows; ++row_A)
-          {
-          for(u32 col_A=0; col_A != A.n_cols; ++col_A)
-            A_rowdata[col_A] = A.at(row_A,col_A);
-          
-          for(u32 col_B=0; col_B != B.n_cols; ++col_B)
-            {
-            const double* B_coldata = B.colptr(col_B);
-            
-            double acc = 0.0;
-            for(u32 i=0; i != B.n_rows; ++i)
-              acc += A_rowdata[i] * B_coldata[i];
-          
-            if( (use_alpha == false) && (use_beta == false) )
-              {
-              C.at(row_A,col_B) = acc;
-              }
-            else
-            if( (use_alpha == true) && (use_beta == false) )
-              {
-              C.at(row_A,col_B) = alpha * acc;
-              }
-            else
-            if( (use_alpha == false) && (use_beta == true) )
-              {
-              const double val = C.at(row_A,col_B);
-              C.at(row_A,col_B) = acc + beta*val;
-              }
-            else
-            if( (use_alpha == true) && (use_beta == true) )
-              {
-              const double val = C.at(row_A,col_B);
-              C.at(row_A,col_B) = alpha*acc + beta*val;
-              }
-            
-            }
-          }
-        }
-      else
-        {
-        check( true, "Need ATLAS or BLAS" );
-        }
-      }
-    #endif
-    }
-  
-  };
-
-
-//! @}

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -18,10 +18,9 @@
 //! \brief
 //! Delayed 'maximum values' operation.
 //! The dimension, along which the maxima are found, is set via 'dim'.
-//! For dim = 0, the maximum value of each column is found.
-//! For dim = 1, the maximum value of each row is found.
+//! For dim = 0, the maximum value of each column is found (i.e. searches by traversing across rows).
+//! For dim = 1, the maximum value of each row is found (i.e. searches by traversing across columns).
 //! The default is dim = 0.
-//! NOTE: This function works differently than in Matlab/Octave.
 
 template<typename T1>
 arma_inline

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -17,10 +17,9 @@
 //! \brief
 //! Delayed 'minimum values' operation.
 //! The dimension, along which the minima are found, is set via 'dim'.
-//! For dim = 0, the maximum value of each column is found (i.e. searches by traversing across rows).
-//! For dim = 1, the maximum value of each row is found (i.e. searches by traversing across columns).
+//! For dim = 0, the minimum value of each column is found (i.e. searches by traversing across rows).
+//! For dim = 1, the minimum value of each row is found (i.e. searches by traversing across columns).
 //! The default is dim = 0.
-//! NOTE: This function works differently than in Matlab/Octave.
 
 template<typename T1>
 arma_inline

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -18,10 +18,12 @@
 
 template<typename T1>
 arma_hot
-arma_inline
+inline
 typename T1::pod_type
-norm_1(const Proxy<T1>& A)
+arma_vec_norm_1(const Proxy<T1>& A)
   {
+  arma_extra_debug_sigprint();
+  
   typedef typename T1::pod_type T;
   typedef typename Proxy<T1>::ea_type ea_type;
   
@@ -50,10 +52,11 @@
 
 template<typename T1>
 arma_hot
-arma_inline
+inline
 typename T1::pod_type
-norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1::elem_type>::result* junk = 0)
+arma_vec_norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1::elem_type>::result* junk = 0)
   {
+  arma_extra_debug_sigprint();
   arma_ignore(junk);
   
   typedef typename T1::pod_type       T;
@@ -89,10 +92,11 @@
 
 template<typename T1>
 arma_hot
-arma_inline
+inline
 typename T1::pod_type
-norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0)
+arma_vec_norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0)
   {
+  arma_extra_debug_sigprint();
   arma_ignore(junk);
   
   typedef typename T1::pod_type       T;
@@ -116,10 +120,12 @@
 
 template<typename T1>
 arma_hot
-arma_inline
+inline
 typename T1::pod_type
-norm_k(const Proxy<T1>& A, const int k)
+arma_vec_norm_k(const Proxy<T1>& A, const int k)
   {
+  arma_extra_debug_sigprint();
+  
   typedef typename T1::pod_type       T;
   typedef typename Proxy<T1>::ea_type ea_type;
   
@@ -148,10 +154,12 @@
 
 template<typename T1>
 arma_hot
-arma_inline
+inline
 typename T1::pod_type
-norm_max(const Proxy<T1>& A)
+arma_vec_norm_max(const Proxy<T1>& A)
   {
+  arma_extra_debug_sigprint();
+  
   typedef typename T1::pod_type       T;
   typedef typename Proxy<T1>::ea_type ea_type;
   
@@ -185,10 +193,12 @@
 
 template<typename T1>
 arma_hot
-arma_inline
+inline
 typename T1::pod_type
-norm_min(const Proxy<T1>& A)
+arma_vec_norm_min(const Proxy<T1>& A)
   {
+  arma_extra_debug_sigprint();
+  
   typedef typename T1::pod_type       T;
   typedef typename Proxy<T1>::ea_type ea_type;
   
@@ -221,7 +231,66 @@
 
 
 template<typename T1>
-arma_inline
+inline
+typename T1::pod_type
+arma_mat_norm_1(const Proxy<T1>& A)
+  {
+  arma_extra_debug_sigprint();
+  
+  typedef typename T1::elem_type eT;
+  typedef typename T1::pod_type   T;
+  
+  const unwrap<typename Proxy<T1>::stored_type> tmp(A.Q);
+  const Mat<eT>& X = tmp.M;
+  
+  // TODO: this can be sped up with a dedicated implementation
+  return as_scalar( max( sum(abs(X)), 1) );
+  }
+
+
+
+template<typename T1>
+inline
+typename T1::pod_type
+arma_mat_norm_2(const Proxy<T1>& A)
+  {
+  arma_extra_debug_sigprint();
+  
+  typedef typename T1::elem_type eT;
+  typedef typename T1::pod_type   T;
+  
+  const unwrap<typename Proxy<T1>::stored_type> tmp(A.Q);
+  const Mat<eT>& X = tmp.M;
+  
+  Col<T> S;
+  svd(S, X);
+  
+  return (S.n_elem > 0) ? max(S) : T(0);
+  }
+
+
+
+template<typename T1>
+inline
+typename T1::pod_type
+arma_mat_norm_inf(const Proxy<T1>& A)
+  {
+  arma_extra_debug_sigprint();
+  
+  typedef typename T1::elem_type eT;
+  typedef typename T1::pod_type   T;
+  
+  const unwrap<typename Proxy<T1>::stored_type> tmp(A.Q);
+  const Mat<eT>& X = tmp.M;
+  
+  // TODO: this can be sped up with a dedicated implementation
+  return as_scalar( max( sum(abs(X),1) ) );
+  }
+
+
+
+template<typename T1>
+inline
 arma_warn_unused
 typename T1::pod_type
 norm
@@ -232,7 +301,6 @@
   )
   {
   arma_extra_debug_sigprint();
-  
   arma_ignore(junk);
   
   typedef typename T1::elem_type eT;
@@ -240,32 +308,55 @@
   
   const Proxy<T1> A(X.get_ref());
   
-  arma_debug_check(    (A.get_n_elem() == 0),                            "norm(): given object has no elements"  );
-  arma_debug_check( !( (A.get_n_rows() == 1) || (A.get_n_cols() == 1) ), "norm(): given object must be a vector" );
+  if(A.get_n_elem() == 0)
+    {
+    return T(0);
+    }
   
-  switch(k)
+  const bool is_vec = (A.get_n_rows() == 1) || (A.get_n_cols() == 1);
+  
+  if(is_vec == true)
     {
-    case 1:
-      return norm_1(A);
-      break;
-    
-    case 2:
-      return norm_2(A);
-      break;
-    
-    default:
+    switch(k)
       {
-      arma_debug_check( (k == 0), "norm(): k must be greater than zero"   );
+      case 1:
+        return arma_vec_norm_1(A);
+        break;
       
-      return norm_k(A, k);
+      case 2:
+        return arma_vec_norm_2(A);
+        break;
+      
+      default:
+        {
+        arma_debug_check( (k == 0), "norm(): k must be greater than zero"   );
+        return arma_vec_norm_k(A, k);
+        }
       }
     }
+  else
+    {
+    switch(k)
+      {
+      case 1:
+        return arma_mat_norm_1(A);
+        break;
+      
+      case 2:
+        return arma_mat_norm_2(A);
+        break;
+      
+      default:
+        arma_stop("norm(): unsupported matrix norm type");
+        return T(0);
+      }
+    }
   }
 
 
 
 template<typename T1>
-arma_inline
+inline
 arma_warn_unused
 typename T1::pod_type
 norm
@@ -276,7 +367,6 @@
   )
   {
   arma_extra_debug_sigprint();
-  
   arma_ignore(junk);
   
   typedef typename T1::elem_type eT;
@@ -284,27 +374,53 @@
   
   const Proxy<T1> A(X.get_ref());
   
-  arma_debug_check(    (A.get_n_elem() == 0),                            "norm(): given object has no elements"  );
-  arma_debug_check( !( (A.get_n_rows() == 1) || (A.get_n_cols() == 1) ), "norm(): given object must be a vector" );
+  if(A.get_n_elem() == 0)
+    {
+    return T(0);
+    }
   
-  const char sig = method[0];
+  const char sig    = method[0];
+  const bool is_vec = (A.get_n_rows() == 1) || (A.get_n_cols() == 1);
   
-  if( (sig == 'i') || (sig == 'I') || (sig == '+') )   // max norm
+  if(is_vec == true)
     {
-    return norm_max(A);
+    if( (sig == 'i') || (sig == 'I') || (sig == '+') )   // max norm
+      {
+      return arma_vec_norm_max(A);
+      }
+    else
+    if(sig == '-')   // min norm
+      {
+      return arma_vec_norm_min(A);
+      }
+    else
+    if( (sig == 'f') || (sig == 'F') )
+      {
+      return arma_vec_norm_2(A);
+      }
+    else
+      {
+      arma_stop("norm(): unsupported vector norm type");
+      return T(0);
+      }
     }
   else
-  if(sig == '-')   // min norm
     {
-    return norm_min(A);
+    if( (sig == 'i') || (sig == 'I') || (sig == '+') )   // inf norm
+      {
+      return arma_mat_norm_inf(A);
+      }
+    else
+    if( (sig == 'f') || (sig == 'F') )
+      {
+      return arma_vec_norm_2(A);
+      }
+    else
+      {
+      arma_stop("norm(): unsupported matrix norm type");
+      return T(0);
+      }
     }
-  else
-    {
-    arma_stop("norm(): unknown norm type");
-    
-    return T(0);
-    }
-  
   }
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -66,12 +66,15 @@
     {
     #if defined(ARMA_USE_ATLAS)
       {
+      arma_extra_debug_print("atlas::cblas_dot()");
+      
       return atlas::cblas_dot(n_elem, A, B);
       }
     #elif defined(ARMA_USE_BLAS)
       {
-      const blas_int n = n_elem;
-      return blas::dot(&n, A, B);
+      arma_extra_debug_print("blas::dot()");
+      
+      return blas::dot(n_elem, A, B);
       }
     #else
       {
@@ -93,6 +96,8 @@
   {
   #if defined(ARMA_USE_ATLAS)
     {
+    arma_extra_debug_print("atlas::cx_cblas_dot()");
+    
     return atlas::cx_cblas_dot(n_elem, A, B);
     }
   #elif defined(ARMA_USE_BLAS)

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp	2010-11-10 16:19:21 UTC (rev 2426)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp	2010-11-11 15:47:37 UTC (rev 2427)
@@ -162,8 +162,12 @@
   {
   arma_extra_debug_sigprint();
   
-  arma_check( (arma_isfinite(sample) == false), "running_stat: non-finite sample given" );
-
+  if( arma_isfinite(sample) == false )
+    {
+    arma_print("running_stat: sample ignored as it is non-finite" );
+    return;
+    }
+  
   running_stat_aux::update_stats(*this, sample);
   }
 
@@ -179,7 +183,11 @@
   
   isnt_same_type<eT, std::complex< typename running_stat<eT>::T > >::check();
   
-  arma_check( (arma_isfinite(sample) == false), "running_stat: non-finite sample given" );
+  if( arma_isfinite(sample) == false )
+    {
+    arma_print("running_stat: sample ignored as it is non-finite" );
+    return;
+    }
   
   running_stat_aux::update_stats(*this, sample);
   }



More information about the Rcpp-commits mailing list