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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 4 13:36:25 CEST 2012


Author: edd
Date: 2012-10-04 13:36:25 +0200 (Thu, 04 Oct 2012)
New Revision: 3788

Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/NEWS.Rd
   pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_speye.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp
   pkg/RcppArmadillo/man/RcppArmadillo-package.Rd
Log:
Release 0.3.4.3 with Armadillo 3.4.3


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/ChangeLog	2012-10-04 11:36:25 UTC (rev 3788)
@@ -1,3 +1,9 @@
+2012-10-04  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.3.4.3
+
+	* inst/include/*: Upgraded to new release 3.4.3 of Armadillo
+
 2012-09-25  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.3.4.2

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/DESCRIPTION	2012-10-04 11:36:25 UTC (rev 3788)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.4.2
+Version: 0.3.4.3
 Date: $Date$
 Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
 Maintainer: Dirk Eddelbuettel <edd at debian.org>
@@ -21,7 +21,7 @@
  (due to speed and/or integration capabilities), rather than another language.
  .
  The RcppArmadillo package includes the header files from the templated
- Armadillo library (currently version 3.4.2). Thus users do not need to
+ Armadillo library (currently version 3.4.3). 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.Rd
===================================================================
--- pkg/RcppArmadillo/inst/NEWS.Rd	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/inst/NEWS.Rd	2012-10-04 11:36:25 UTC (rev 3788)
@@ -2,6 +2,16 @@
 \title{News for Package 'RcppArmadillo'}
 \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
+\section{Changes in RcppArmadillo version 0.3.4.3 (2012-10-04)}{
+  \itemize{
+    \item Upgraded to Armadillo release 3.4.3
+    \itemize{
+      \item fix for aliasing issue in \code{diagmat()}
+      \item fix for \code{speye()} signature
+    }
+  }
+}
+
 \section{Changes in RcppArmadillo version 0.3.4.2 (2012-09-25)}{
   \itemize{
     \item Upgraded to Armadillo release 3.4.2

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp	2012-10-04 11:36:25 UTC (rev 3788)
@@ -18,7 +18,7 @@
 
 #define ARMA_VERSION_MAJOR 3
 #define ARMA_VERSION_MINOR 4
-#define ARMA_VERSION_PATCH 2
+#define ARMA_VERSION_PATCH 3
 #define ARMA_VERSION_NAME  "Ku De Ta"
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp	2012-10-04 11:36:25 UTC (rev 3788)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2010 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
@@ -18,12 +18,17 @@
 //! interpret a matrix or a vector as a diagonal matrix (i.e. off-diagonal entries are zero)
 template<typename T1>
 arma_inline
-const Op<T1, op_diagmat>
-diagmat(const Base<typename T1::elem_type,T1>& X)
+typename
+enable_if2
+  <
+  is_arma_type<T1>::value,
+  const Op<T1, op_diagmat>
+  >::result
+diagmat(const T1& X)
   {
   arma_extra_debug_sigprint();
   
-  return Op<T1, op_diagmat>(X.get_ref());
+  return Op<T1, op_diagmat>(X);
   }
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_speye.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_speye.hpp	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_speye.hpp	2012-10-04 11:36:25 UTC (rev 3788)
@@ -1,4 +1,5 @@
 // Copyright (C) 2012 Conrad Sanderson
+// Copyright (C) 2012 Ryan Curtin
 // 
 // This file is part of the Armadillo C++ library.
 // It is provided without any warranty of fitness
@@ -16,14 +17,15 @@
 
 
 //! Generate a sparse matrix with the values along the main diagonal set to one
-template<typename eT>
+template<typename obj_type>
 inline
-SpMat<eT>
-speye(const uword n_rows, const uword n_cols)
+obj_type
+speye(const uword n_rows, const uword n_cols, const typename arma_SpMat_SpCol_SpRow_only<obj_type>::result* junk = NULL)
   {
   arma_extra_debug_sigprint();
+  arma_ignore(junk);
   
-  SpMat<eT> out;
+  obj_type out;
   
   out.eye(n_rows, n_cols);
   
@@ -32,6 +34,7 @@
 
 
 
+// Convenience shortcut method (no template parameter necessary)
 inline
 sp_mat
 speye(const uword n_rows, const uword n_cols)

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp	2012-10-04 11:36:25 UTC (rev 3788)
@@ -101,23 +101,31 @@
       }
     else   // generate a diagonal matrix out of a matrix
       {
-      // NOTE: we're assuming that the output matrix is the same as the matrix provided by the Proxy,
-      // NOTE: and the alias is not due to a matrix using auxiliary memory;
-      // NOTE: this assumption is currently valid for matrices, but not for vectors;
-      // NOTE: as we've checked that at this point in code we're dealing with a matrix,
-      // NOTE: the assumption is thus currently valid
-      
       arma_debug_check( (n_rows != n_cols), "diagmat(): given matrix is not square" );
       
-      for(uword i=0; i < n_rows; ++i)
+      if( (Proxy<T1>::has_subview == false) && (Proxy<T1>::fake_mat == false) )
         {
-        eT* colptr = out.colptr(i);
+        // NOTE: we have aliasing and it's not due to a subview, hence we're assuming that the output matrix already has the correct size
         
-        // clear above the diagonal
-        arrayops::inplace_set(colptr, eT(0), i);
+        for(uword i=0; i < n_rows; ++i)
+          {
+          const eT val = P.at(i,i);
+          
+          arrayops::inplace_set(out.colptr(i), eT(0), n_rows);
+          
+          out.at(i,i) = val;
+          }
+        }
+      else
+        {
+        podarray<eT> tmp(n_rows);
+        eT* tmp_mem = tmp.memptr();
         
-        // clear below the diagonal
-        arrayops::inplace_set(colptr+(i+1), eT(0), n_rows-1-i);
+        for(uword i=0; i < n_rows; ++i)  { tmp_mem[i] = P.at(i,i); }
+        
+        out.zeros(n_rows, n_rows);
+        
+        for(uword i=0; i < n_rows; ++i)  { out.at(i,i) = tmp_mem[i]; }
         }
       }
     }

Modified: pkg/RcppArmadillo/man/RcppArmadillo-package.Rd
===================================================================
--- pkg/RcppArmadillo/man/RcppArmadillo-package.Rd	2012-10-01 00:24:43 UTC (rev 3787)
+++ pkg/RcppArmadillo/man/RcppArmadillo-package.Rd	2012-10-04 11:36:25 UTC (rev 3788)
@@ -13,8 +13,8 @@
   \tabular{ll}{
     Package: \tab RcppArmadillo\cr
     Type: \tab Package\cr
-    Version: \tab 0.3.4.2\cr
-    Date: \tab 2012-09-25\cr
+    Version: \tab 0.3.4.3\cr
+    Date: \tab 2012-10-04\cr
     License: \tab GPL (>= 2)\cr
     LazyLoad: \tab yes\cr
   }



More information about the Rcpp-commits mailing list