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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 20 13:17:58 CET 2013


Author: edd
Date: 2013-02-20 13:17:57 +0100 (Wed, 20 Feb 2013)
New Revision: 4265

Modified:
   pkg/RcppArmadillo/ChangeLog
   pkg/RcppArmadillo/DESCRIPTION
   pkg/RcppArmadillo/inst/NEWS.Rd
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_iterators_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_bones.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_iterators_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_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/diskio_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/eOpCube_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_conv_to.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eps.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_mean.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_reshape.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/fn_svd.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_find_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_mean_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/op_var_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/spop_var_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem2_meat.hpp
   pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
Log:
Release 0.3.6.3 containing Armadillo 0.3.6.3


Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/ChangeLog	2013-02-20 12:17:57 UTC (rev 4265)
@@ -1,3 +1,9 @@
+2013-02-20  Dirk Eddelbuettel  <edd at debian.org>
+
+	* DESCRIPTION: Release 0.3.6.3
+
+	* inst/include/*: Upgraded to new release 3.6.3 of Armadillo
+
 2013-01-29  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.3.6.2

Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/DESCRIPTION	2013-02-20 12:17:57 UTC (rev 4265)
@@ -1,7 +1,7 @@
 Package: RcppArmadillo
 Type: Package
 Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.6.2
+Version: 0.3.6.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.6.1). Thus users do not need to
+ Armadillo library (currently version 3.6.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	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/NEWS.Rd	2013-02-20 12:17:57 UTC (rev 4265)
@@ -2,6 +2,17 @@
 \title{News for Package 'RcppArmadillo'}
 \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
+\section{Changes in RcppArmadillo version 0.3.6.3 (2013-02-20)}{
+  \itemize{
+    \item Upgraded to Armadillo release Version 3.6.3
+    \itemize{
+      \item faster \code{find()}
+      \item minor fix for non-contiguous submatrix views to handle empty vectors of indices
+      \item reduction of pedantic compiler warnings
+    }
+  }
+}
+
 \section{Changes in RcppArmadillo version 0.3.6.2 (2013-01-29)}{
   \itemize{
     \item Upgraded to Armadillo release Version 3.6.2

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2012 Conrad Sanderson
+// Copyright (C) 2008-2013 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2013 Conrad Sanderson
 // Copyright (C) 2012 Ryan Curtin
 // 
 // This file is part of the Armadillo C++ library.
@@ -480,6 +480,8 @@
   inline bool  empty() const;
   inline uword size()  const;
   
+  inline void swap(Mat& B);
+  
   inline void steal_mem(Mat& X);  //!< don't use this unless you're writing code internal to Armadillo
   
   template<uword fixed_n_rows, uword fixed_n_cols> class fixed;

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2012 Conrad Sanderson
+// Copyright (C) 2008-2013 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2013 Conrad Sanderson
 // Copyright (C) 2012 Ryan Curtin
 // 
 // This file is part of the Armadillo C++ library.
@@ -716,6 +716,90 @@
 
 
 
+//! EXPERIMENTAL: swap the contents of this matrix, denoted as matrix A, with given matrix B
+template<typename eT>
+inline
+void
+Mat<eT>::swap(Mat<eT>& B)
+  {
+  Mat<eT>& A = (*this);
+  
+  arma_extra_debug_sigprint(arma_boost::format("A = %x   B = %x") % &A % &B);
+  
+  arma_debug_check( (A.vec_state != B.vec_state), "Mat::swap(): incompatible object types" );
+  
+  const uhword A_mem_state = A.mem_state;
+  const uhword B_mem_state = B.mem_state;
+  
+  if( (A_mem_state == 0) && (B_mem_state == 0) )
+    {
+    const uword A_n_elem = A.n_elem;
+    const uword B_n_elem = B.n_elem;
+    
+    const bool A_use_local_mem = (A_n_elem <= arma_config::mat_prealloc);
+    const bool B_use_local_mem = (B_n_elem <= arma_config::mat_prealloc);
+    
+    if( (A_use_local_mem == false) && (B_use_local_mem == false) )
+      {
+      std::swap( access::rw(A.mem), access::rw(B.mem) );
+      }
+    else
+    if( (A_use_local_mem == true) && (B_use_local_mem == true) )
+      {
+      const uword N = (std::max)(A_n_elem, B_n_elem);
+      
+      eT* A_mem = A.memptr();
+      eT* B_mem = B.memptr();
+      
+      for(uword ii=0; ii < N; ++ii)  { std::swap( A_mem[ii], B_mem[ii] ); }
+      }
+    else
+    if( (A_use_local_mem == true) && (B_use_local_mem == false) )
+      {
+      eT* A_mem_local = &(A.mem_local[0]);
+      eT* B_mem_local = &(B.mem_local[0]);
+      
+      arrayops::copy(B_mem_local, A_mem_local, A_n_elem);
+      
+      access::rw(A.mem) = B.mem;
+      access::rw(B.mem) = B_mem_local;
+      }
+    else
+    if( (A_use_local_mem == false) && (B_use_local_mem == true) )
+      {
+      eT* A_mem_local = &(A.mem_local[0]);
+      eT* B_mem_local = &(B.mem_local[0]);
+      
+      arrayops::copy(A_mem_local, B_mem_local, B_n_elem);
+      
+      access::rw(B.mem) = A.mem;
+      access::rw(A.mem) = A_mem_local;
+      }
+    
+    std::swap( access::rw(A.n_rows), access::rw(B.n_rows) );
+    std::swap( access::rw(A.n_cols), access::rw(B.n_cols) );
+    std::swap( access::rw(A.n_elem), access::rw(B.n_elem) );
+    }
+  else
+  if( (A_mem_state == 3) && (B_mem_state == 3) )
+    {
+    arma_debug_check( ((A.n_rows != B.n_rows) || (A.n_cols != B.n_cols)), "Mat::swap(): incompatible object types" );
+    
+    const uword N = A.n_elem;
+    
+    eT* A_mem = A.memptr();
+    eT* B_mem = B.memptr();
+    
+    for(uword ii=0; ii < N; ++ii)  { std::swap(A_mem[ii], B_mem[ii]); }
+    }
+  else
+    {
+    arma_bad("Mat::swap(): incompatible object types");
+    }
+  }
+
+
+
 //! try to steal the memory from a given matrix; 
 //! if memory can't be stolen, copy the given matrix
 template<typename eT>

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_iterators_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_iterators_meat.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_iterators_meat.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -32,10 +32,10 @@
 
 template<typename eT>
 inline
-SpMat<eT>::iterator_base::iterator_base(const SpMat<eT>& in_M, const uword col, const uword pos)
+SpMat<eT>::iterator_base::iterator_base(const SpMat<eT>& in_M, const uword in_col, const uword in_pos)
   : M(in_M)
-  , internal_col(col)
-  , internal_pos(pos)
+  , internal_col(in_col)
+  , internal_pos(in_pos)
   {
   // Nothing to do.
   }

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -616,7 +616,7 @@
   podarray<eT> partial_sums(n_rows);
   partial_sums.zeros();
 
-  for(uword col = 0; col < n_cols; ++col)
+  for(uword lcol = 0; lcol < n_cols; ++lcol)
     {
     const_iterator it = begin();
 
@@ -624,7 +624,7 @@
       {
       const eT value = (*it);
 
-      partial_sums[it.row()] += (value * p.at(it.col(), col));
+      partial_sums[it.row()] += (value * p.at(it.col(), lcol));
 
       ++it;
       }
@@ -636,8 +636,8 @@
         {
         access::rw(z.values[cur_pos]) = partial_sums[i];
         access::rw(z.row_indices[cur_pos]) = i;
-        ++access::rw(z.col_ptrs[col + 1]);
-        //printf("colptr %d now %d\n", col + 1, z.col_ptrs[col + 1]);
+        ++access::rw(z.col_ptrs[lcol + 1]);
+        //printf("colptr %d now %d\n", lcol + 1, z.col_ptrs[lcol + 1]);
         ++cur_pos;
         partial_sums[i] = 0; // Would it be faster to do this in batch later?
         }
@@ -1028,12 +1028,10 @@
   // efficient way, by calculating the number of nonzero elements the output
   // matrix will have, allocating the memory correctly, and then filling the
   // matrix correctly.  However... for now, this works okay.
-  for(uword col = 0; col < n_cols; ++col)
+  for(uword lcol = 0; lcol < n_cols; ++lcol)
+  for(uword lrow = 0; lrow < n_rows; ++lrow)
     {
-    for(uword row = 0; row < n_rows; ++row)
-      {
-      at(row, col) += x.at(row, col);
-      }
+    at(lrow, lcol) += x.at(lrow, lcol);
     }
   
   return *this;
@@ -1051,12 +1049,10 @@
   arma_debug_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "subtraction");
   
   // Loop over every element.
-  for(uword col = 0; col < n_cols; ++col)
+  for(uword lcol = 0; lcol < n_cols; ++lcol)
+  for(uword lrow = 0; lrow < n_rows; ++lrow)
     {
-    for(uword row = 0; row < n_rows; ++row)
-      {
-      at(row, col) -= x.at(row, col);
-      }
+    at(lrow, lcol) -= x.at(lrow, lcol);
     }
   
   return *this;
@@ -1078,12 +1074,12 @@
   // Performed in the same fashion as operator*=(SpMat).
   for (const_row_iterator x_row_it = begin_row(); x_row_it.pos() < n_nonzero; ++x_row_it)
     {
-    for (uword col = 0; col < y.n_cols; ++col)
+    for (uword lcol = 0; lcol < y.n_cols; ++lcol)
       {
       // At this moment in the loop, we are calculating anything that is contributed to by *x_row_it and *y_col_it.
       // Given that our position is x_ab and y_bc, there will only be a contribution if x.col == y.row, and that
       // contribution will be in location z_ac.
-      z.at(x_row_it.row, col) += (*x_row_it) * y.at(x_row_it.col, col);
+      z.at(x_row_it.row, lcol) += (*x_row_it) * y.at(x_row_it.col, lcol);
       }
     }
 
@@ -1104,12 +1100,10 @@
   arma_debug_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "element-wise multiplication");
   
   // Loop over every element.
-  for(uword col = 0; col < n_cols; ++col)
+  for(uword lcol = 0; lcol < n_cols; ++lcol)
+  for(uword lrow = 0; lrow < n_rows; ++lrow)
     {
-    for(uword row = 0; row < n_rows; ++row)
-      {
-      at(row, col) *= x.at(row, col);
-      }
+    at(lrow, lcol) *= x.at(lrow, lcol);
     }
 
   return *this;
@@ -1127,12 +1121,10 @@
   arma_debug_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "element-wise division");
   
   // Loop over every element.
-  for(uword col = 0; col < n_cols; ++col)
+  for(uword lcol = 0; lcol < n_cols; ++lcol)
+  for(uword lrow = 0; lrow < n_rows; ++lrow)
     {
-    for(uword row = 0; row < n_rows; ++row)
-      {
-      at(row, col) /= x.at(row, col);
-      }
+    at(lrow, lcol) /= x.at(lrow, lcol);
     }
 
   return *this;
@@ -1698,10 +1690,10 @@
   uword col1 = (in_row1 < in_row2) ? in_row1 : in_row2;
   uword col2 = (in_row1 < in_row2) ? in_row2 : in_row1;
 
-  for (uword col = 0; col < n_cols; col++)
+  for (uword lcol = 0; lcol < n_cols; lcol++)
     {
     // If there is nothing in this column we can ignore it.
-    if (col_ptrs[col] == col_ptrs[col + 1])
+    if (col_ptrs[lcol] == col_ptrs[lcol + 1])
       {
       continue;
       }
@@ -1710,7 +1702,7 @@
     uword loc1 = n_nonzero + 1;
     uword loc2 = n_nonzero + 1;
 
-    for (uword search_pos = col_ptrs[col]; search_pos < col_ptrs[col + 1]; search_pos++)
+    for (uword search_pos = col_ptrs[lcol]; search_pos < col_ptrs[lcol + 1]; search_pos++)
       {
       if (row_indices[search_pos] == col1)
         {
@@ -1737,7 +1729,7 @@
       {
       // We need to find the correct place to move our value to.  It will be forward (not backwards) because in_row2 > in_row1.
       // Each iteration of the loop swaps the current value (loc1) with (loc1 + 1); in this manner we move our value down to where it should be.
-      while (((loc1 + 1) < col_ptrs[col + 1]) && (row_indices[loc1 + 1] < in_row2))
+      while (((loc1 + 1) < col_ptrs[lcol + 1]) && (row_indices[loc1 + 1] < in_row2))
         {
         // Swap both the values and the indices.  The column should not change.
         eT tmp = values[loc1];
@@ -1759,7 +1751,7 @@
       {
       // We need to find the correct place to move our value to.  It will be backwards (not forwards) because in_row1 < in_row2.
       // Each iteration of the loop swaps the current value (loc2) with (loc2 - 1); in this manner we move our value up to where it should be.
-      while (((loc2 - 1) >= col_ptrs[col]) && (row_indices[loc2 - 1] > in_row1))
+      while (((loc2 - 1) >= col_ptrs[lcol]) && (row_indices[loc2 - 1] > in_row1))
         {
         // Swap both the values and the indices.  The column should not change.
         eT tmp = values[loc2];
@@ -1792,11 +1784,11 @@
   arma_extra_debug_sigprint();
 
   // slow but works
-  for(uword row = 0; row < n_rows; ++row)
+  for(uword lrow = 0; lrow < n_rows; ++lrow)
     {
-    eT tmp = at(row, in_col1);
-    at(row, in_col1) = at(row, in_col2);
-    at(row, in_col2) = tmp;
+    eT tmp = at(lrow, in_col1);
+    at(lrow, in_col1) = at(lrow, in_col2);
+    at(lrow, in_col2) = tmp;
     }
   }
 
@@ -1854,9 +1846,9 @@
   for (i = 0, j = 0; i < vlength; ++i)
     {
     // Store the row of the ith element.
-    const uword row = row_indices[i];
+    const uword lrow = row_indices[i];
     // Is the ith element in the range of rows we want to remove?
-    if (row >= in_row1 && row <= in_row2)
+    if (lrow >= in_row1 && lrow <= in_row2)
       {
       // Increment our "removed elements" counter.
       ++j;
@@ -1880,7 +1872,7 @@
       // j = 0 until we remove the first element.
       if (j != 0)
         {
-        access::rw(row_indices[i - j]) = (row > in_row2) ? (row - (in_row2 - in_row1 + 1)) : row;
+        access::rw(row_indices[i - j]) = (lrow > in_row2) ? (lrow - (in_row2 - in_row1 + 1)) : lrow;
         access::rw(values[i - j]) = values[i];
         }
       }
@@ -2990,13 +2982,13 @@
   uword cur_index = 0;
   uword count     = 0;  
   
-  for(uword col = 0; col < in_cols; ++col)
-  for(uword row = 0; row < in_rows; ++row)
+  for(uword lcol = 0; lcol < in_cols; ++lcol)
+  for(uword lrow = 0; lrow < in_rows; ++lrow)
     {
     if(count == indices[cur_index])
       {
-      access::rw(row_indices[cur_index]) = row;
-      access::rw(col_ptrs[col + 1])++;
+      access::rw(row_indices[cur_index]) = lrow;
+      access::rw(col_ptrs[lcol + 1])++;
       ++cur_index;
       }
     
@@ -3010,9 +3002,9 @@
     }
   
   // Sum column pointers.
-  for(uword col = 1; col <= in_cols; ++col)
+  for(uword lcol = 1; lcol <= in_cols; ++lcol)
     {
-    access::rw(col_ptrs[col]) += col_ptrs[col - 1];
+    access::rw(col_ptrs[lcol]) += col_ptrs[lcol - 1];
     }
   
   return *this;
@@ -3067,13 +3059,13 @@
   uword cur_index = 0;
   uword count     = 0;  
   
-  for(uword col = 0; col < in_cols; ++col)
-  for(uword row = 0; row < in_rows; ++row)
+  for(uword lcol = 0; lcol < in_cols; ++lcol)
+  for(uword lrow = 0; lrow < in_rows; ++lrow)
     {
     if(count == indices[cur_index])
       {
-      access::rw(row_indices[cur_index]) = row;
-      access::rw(col_ptrs[col + 1])++;
+      access::rw(row_indices[cur_index]) = lrow;
+      access::rw(col_ptrs[lcol + 1])++;
       ++cur_index;
       }
     
@@ -3087,9 +3079,9 @@
     }
   
   // Sum column pointers.
-  for(uword col = 1; col <= in_cols; ++col)
+  for(uword lcol = 1; lcol <= in_cols; ++lcol)
     {
-    access::rw(col_ptrs[col]) += col_ptrs[col - 1];
+    access::rw(col_ptrs[lcol]) += col_ptrs[lcol - 1];
     }
   
   return *this;
@@ -3743,7 +3735,7 @@
   line_start = 0;
   line_end = 0;
 
-  uword row = 0;
+  uword lrow = 0;
 
   while (line_start < text.length())
     {
@@ -3756,7 +3748,7 @@
     std::string::size_type line_len = line_end - line_start + 1;
     std::stringstream line_stream(text.substr(line_start, line_len));
 
-    uword col = 0;
+    uword lcol = 0;
     eT val;
 
     while (line_stream >> val)
@@ -3764,13 +3756,13 @@
       // Only add nonzero elements.
       if (val != eT(0))
         {
-        get_value(row, col) = val;
+        get_value(lrow, lcol) = val;
         }
 
-      ++col;
+      ++lcol;
       }
 
-    ++row;
+    ++lrow;
     line_start = line_end + 1;
 
     }
@@ -3847,12 +3839,12 @@
         if(n_nonzero > 0)
           {
           // Copy old elements.
-          uword copy_size = std::min(n_nonzero, new_n_nonzero);
+          uword copy_len = std::min(n_nonzero, new_n_nonzero);
           
-          arrayops::copy(new_values,      values,      copy_size);
-          arrayops::copy(new_row_indices, row_indices, copy_size);
+          arrayops::copy(new_values,      values,      copy_len);
+          arrayops::copy(new_row_indices, row_indices, copy_len);
           }
-          
+        
         memory::release(values);
         memory::release(row_indices);
         
@@ -4222,10 +4214,10 @@
 SpMat<eT>::get_value(const uword i)
   {
   // First convert to the actual location.
-  uword col = i / n_rows; // Integer division.
-  uword row = i % n_rows;
+  uword lcol = i / n_rows; // Integer division.
+  uword lrow = i % n_rows;
 
-  return get_value(row, col);
+  return get_value(lrow, lcol);
   }
 
 
@@ -4238,10 +4230,10 @@
 SpMat<eT>::get_value(const uword i) const
   {
   // First convert to the actual location.
-  uword col = i / n_rows; // Integer division.
-  uword row = i % n_rows;
+  uword lcol = i / n_rows; // Integer division.
+  uword lrow = i % n_rows;
 
-  return get_value(row, col);
+  return get_value(lrow, lcol);
   }
 
 
@@ -4326,12 +4318,12 @@
 uword
 SpMat<eT>::get_position(const uword i) const
   {
-  uword row, col;
+  uword lrow, lcol;
   
-  get_position(i, row, col);
+  get_position(i, lrow, lcol);
   
   // Assemble the row/col into the element's location in the matrix.
-  return (row + n_rows * col);
+  return (lrow + n_rows * lcol);
   }
 
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_bones.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_bones.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -234,7 +234,7 @@
 
     inline iterator(SpSubview& in_M, const uword initial_pos = 0) : const_iterator(in_M, initial_pos) { }
     inline iterator(SpSubview& in_M, const uword in_row, const uword in_col) : const_iterator(in_M, in_row, in_col) { }
-    inline iterator(SpSubview& in_M, const uword in_row, const uword in_col, const uword in_pos, const uword skip_pos) : const_iterator(in_M, in_row, in_col, in_pos, skip_pos) { }
+    inline iterator(SpSubview& in_M, const uword in_row, const uword in_col, const uword in_pos, const uword in_skip_pos) : const_iterator(in_M, in_row, in_col, in_pos, in_skip_pos) { }
     inline iterator(const iterator& other) : const_iterator(other) { }
 
     inline SpValProxy<SpSubview<eT> > operator*();

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_iterators_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_iterators_meat.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_iterators_meat.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -32,11 +32,11 @@
 
 template<typename eT>
 inline
-SpSubview<eT>::iterator_base::iterator_base(const SpSubview<eT>& in_M, const uword col, const uword pos, const uword skip_pos)
+SpSubview<eT>::iterator_base::iterator_base(const SpSubview<eT>& in_M, const uword in_col, const uword in_pos, const uword in_skip_pos)
   : M(in_M)
-  , internal_col(col)
-  , internal_pos(pos)
-  , skip_pos(skip_pos)
+  , internal_col(in_col)
+  , internal_pos(in_pos)
+  , skip_pos    (in_skip_pos)
   {
   // Nothing to do.
   }
@@ -66,36 +66,36 @@
   if(in_M.n_nonzero == 0)
     {
     iterator_base::internal_col = in_M.n_cols;
-    iterator_base::skip_pos = in_M.m.n_nonzero;
+    iterator_base::skip_pos     = in_M.m.n_nonzero;
     return;
     }
 
   // Figure out the row and column of the position.
-  // skip_pos holds the number of values which aren't part of this subview.
+  // lskip_pos holds the number of values which aren't part of this subview.
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_rows  = iterator_base::M.n_rows;
-  const uword n_cols  = iterator_base::M.n_cols;
+  const uword ln_rows = iterator_base::M.n_rows;
+  const uword ln_cols = iterator_base::M.n_cols;
 
-  uword cur_pos = 0; // off by one because we might be searching for pos 0
-  uword skip_pos = iterator_base::M.m.col_ptrs[aux_col];
-  uword cur_col = 0;
+  uword cur_pos   = 0; // off by one because we might be searching for pos 0
+  uword lskip_pos = iterator_base::M.m.col_ptrs[aux_col];
+  uword cur_col   = 0;
 
   while(cur_pos < (iterator_base::internal_pos + 1))
     {
     // Have we stepped forward a column (or multiple columns)?
-    while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < n_cols))
+    while(((lskip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols))
       {
       ++cur_col;
       }
 
     // See if the current position is in the subview.
-    const uword row_index = iterator_base::M.m.row_indices[cur_pos + skip_pos];
+    const uword row_index = iterator_base::M.m.row_indices[cur_pos + lskip_pos];
     if(row_index < aux_row)
       {
-      ++skip_pos; // not valid
+      ++lskip_pos; // not valid
       }
-    else if(row_index < (aux_row + n_rows))
+    else if(row_index < (aux_row + ln_rows))
       {
       ++cur_pos; // valid, in the subview
       }
@@ -103,12 +103,12 @@
       {
       // skip to end of column
       const uword next_colptr = iterator_base::M.m.col_ptrs[cur_col + aux_col + 1];
-      skip_pos += (next_colptr - (cur_pos + skip_pos));
+      lskip_pos += (next_colptr - (cur_pos + lskip_pos));
       }
     }
 
   iterator_base::internal_col = cur_col;
-  iterator_base::skip_pos = skip_pos;
+  iterator_base::skip_pos     = lskip_pos;
   }
 
 
@@ -131,8 +131,8 @@
   // Because we have to count the points in this subview and not in this subview, this becomes a little difficult and slow.
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_rows  = iterator_base::M.n_rows;
-  const uword n_cols  = iterator_base::M.n_cols;
+  const uword ln_rows = iterator_base::M.n_rows;
+  const uword ln_cols = iterator_base::M.n_cols;
 
   uword cur_pos = 0;
   uword skip_pos = iterator_base::M.m.col_ptrs[aux_col];
@@ -146,7 +146,7 @@
       {
       ++skip_pos;
       }
-    else if(row_index < (aux_row + n_rows))
+    else if(row_index < (aux_row + ln_rows))
       {
       ++cur_pos;
       }
@@ -158,7 +158,7 @@
       }
 
     // Have we stepped forward a column (or multiple columns)?
-    while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < n_cols))
+    while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols))
       {
       ++cur_col;
       }
@@ -181,7 +181,7 @@
         }
 
       // Ensure we didn't step forward a column; if we did, we need to stop.
-      while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < n_cols))
+      while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols))
         {
         ++cur_col;
         }
@@ -203,9 +203,9 @@
     row_index = iterator_base::M.m.row_indices[cur_pos + skip_pos];
 
     // Are we at the last position?
-    if(cur_col >= n_cols)
+    if(cur_col >= ln_cols)
       {
-      cur_col = n_cols;
+      cur_col = ln_cols;
       // Make sure we will be pointing at the last element in the parent matrix.
       skip_pos = iterator_base::M.m.n_nonzero - iterator_base::M.n_nonzero;
       break;
@@ -215,7 +215,7 @@
       {
       ++skip_pos;
       }
-    else if(row_index < (aux_row + n_rows))
+    else if(row_index < (aux_row + ln_rows))
       {
       break; // found
       }
@@ -225,20 +225,20 @@
       }
 
     // Did we move any columns?
-    while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < n_cols))
+    while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols))
       {
       ++cur_col;
       }
     }
 
   // It is possible we have moved another column.
-  while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < n_cols))
+  while(((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols))
     {
     ++cur_col;
     }
 
   iterator_base::internal_pos = cur_pos;
-  iterator_base::skip_pos = skip_pos;
+  iterator_base::skip_pos     = skip_pos;
   iterator_base::internal_col = cur_col;
   }
 
@@ -246,8 +246,8 @@
 
 template<typename eT>
 inline
-SpSubview<eT>::const_iterator::const_iterator(const SpSubview<eT>& in_M, uword in_row, uword in_col, uword in_pos, uword skip_pos)
-  : iterator_base(in_M, in_col, in_pos, skip_pos)
+SpSubview<eT>::const_iterator::const_iterator(const SpSubview<eT>& in_M, uword in_row, uword in_col, uword in_pos, uword in_skip_pos)
+  : iterator_base(in_M, in_col, in_pos, in_skip_pos)
   {
   // Nothing to do.
   }
@@ -271,51 +271,51 @@
   {
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_rows  = iterator_base::M.n_rows;
-  const uword n_cols  = iterator_base::M.n_cols;
+  const uword ln_rows = iterator_base::M.n_rows;
+  const uword ln_cols = iterator_base::M.n_cols;
 
-  uword cur_col = iterator_base::internal_col;
-  uword cur_pos = iterator_base::internal_pos + 1;
-  uword skip_pos = iterator_base::skip_pos;
+  uword cur_col   = iterator_base::internal_col;
+  uword cur_pos   = iterator_base::internal_pos + 1;
+  uword lskip_pos = iterator_base::skip_pos;
   uword row_index;
 
   while(true)
     {
     const uword next_colptr = iterator_base::M.m.col_ptrs[cur_col + aux_col + 1];
-    row_index = iterator_base::M.m.row_indices[cur_pos + skip_pos];
+    row_index = iterator_base::M.m.row_indices[cur_pos + lskip_pos];
 
     // Did we move any columns?
-    while((cur_col < n_cols) && ((skip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]))
+    while((cur_col < ln_cols) && ((lskip_pos + cur_pos) >= iterator_base::M.m.col_ptrs[cur_col + aux_col + 1]))
       {
       ++cur_col;
       }
 
     // Are we at the last position?
-    if(cur_col >= n_cols)
+    if(cur_col >= ln_cols)
       {
-      cur_col = n_cols;
+      cur_col = ln_cols;
       // Make sure we will be pointing at the last element in the parent matrix.
-      skip_pos = iterator_base::M.m.n_nonzero - iterator_base::M.n_nonzero;
+      lskip_pos = iterator_base::M.m.n_nonzero - iterator_base::M.n_nonzero;
       break;
       }
 
     if(row_index < aux_row)
       {
-      ++skip_pos;
+      ++lskip_pos;
       }
-    else if(row_index < (aux_row + n_rows))
+    else if(row_index < (aux_row + ln_rows))
       {
       break; // found
       }
     else
       {
-      skip_pos += (next_colptr - (cur_pos + skip_pos));
+      lskip_pos += (next_colptr - (cur_pos + lskip_pos));
       }
     }
 
   iterator_base::internal_pos = cur_pos;
   iterator_base::internal_col = cur_col;
-  iterator_base::skip_pos = skip_pos;
+  iterator_base::skip_pos     = lskip_pos;
 
   return *this;
   }
@@ -343,10 +343,10 @@
   {
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_rows  = iterator_base::M.n_rows;
+  const uword ln_rows = iterator_base::M.n_rows;
 
-  uword cur_col = iterator_base::internal_col;
-  uword cur_pos = iterator_base::internal_pos - 1;
+  uword cur_col  = iterator_base::internal_col;
+  uword cur_pos  = iterator_base::internal_pos - 1;
   uword skip_pos = iterator_base::skip_pos;
 
   // Special condition for end of iterator.
@@ -374,7 +374,7 @@
       {
       skip_pos -= (colptr - (cur_pos + skip_pos) + 1);
       }
-    else if(row_index < (aux_row + n_rows))
+    else if(row_index < (aux_row + ln_rows))
       {
       break; // found
       }
@@ -385,7 +385,7 @@
     }
 
   iterator_base::internal_pos = cur_pos;
-  iterator_base::skip_pos = skip_pos;
+  iterator_base::skip_pos     = skip_pos;
   iterator_base::internal_col = cur_col;
 
   return *this;
@@ -577,7 +577,7 @@
 
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_cols  = iterator_base::M.n_cols;
+  const uword ln_cols = iterator_base::M.n_cols;
 
   // We don't know where the elements are in each row.  What we will do is
   // loop across all valid columns looking for elements in row 0 (and add to
@@ -619,7 +619,7 @@
       }
 
     cur_col++; // Done with the column.  Move on.
-    if(cur_col == n_cols)
+    if(cur_col == ln_cols)
       {
       // Out of columns.  Loop back to the beginning and look on the next row.
       cur_col = 0;
@@ -692,12 +692,12 @@
 
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_cols  = iterator_base::M.n_cols;
+  const uword ln_cols = iterator_base::M.n_cols;
 
   while(true)
     {
     // Increment the current column and see if we are on a new row.
-    if(++cur_col == n_cols)
+    if(++cur_col == ln_cols)
       {
       cur_col = 0;
       ++cur_row;
@@ -771,14 +771,14 @@
 
   const uword aux_col = iterator_base::M.aux_col1;
   const uword aux_row = iterator_base::M.aux_row1;
-  const uword n_cols  = iterator_base::M.n_cols;
+  const uword ln_cols = iterator_base::M.n_cols;
 
   while(true)
     {
     // Decrement the current column and see if we are on a new row.
-    if(--cur_col > n_cols)
+    if(--cur_col > ln_cols)
       {
-      cur_col = n_cols - 1;
+      cur_col = ln_cols - 1;
       cur_row--;
       }
 

Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_meat.hpp	2013-02-20 11:53:00 UTC (rev 4264)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/SpSubview_meat.hpp	2013-02-20 12:17:57 UTC (rev 4265)
@@ -29,13 +29,13 @@
   arma_extra_debug_sigprint();
 
   // There must be a O(1) way to do this
-  uword end     = m.col_ptrs[in_col1 + in_n_cols];
-  uword end_row = in_row1 + in_n_rows;
+  uword lend     = m.col_ptrs[in_col1 + in_n_cols];
+  uword lend_row = in_row1 + in_n_rows;
   uword count   = 0;
 
-  for(uword i = m.col_ptrs[in_col1]; i < end; ++i)
+  for(uword i = m.col_ptrs[in_col1]; i < lend; ++i)
     {
-    if(m.row_indices[i] >= in_row1 && m.row_indices[i] < end_row)
+    if(m.row_indices[i] >= in_row1 && m.row_indices[i] < lend_row)
       {
       ++count;
       }
@@ -60,13 +60,13 @@
   arma_extra_debug_sigprint();
 
   // There must be a O(1) way to do this
-  uword end     = m.col_ptrs[in_col1 + in_n_cols];
-  uword end_row = in_row1 + in_n_rows;
-  uword count   = 0;
+  uword lend     = m.col_ptrs[in_col1 + in_n_cols];
+  uword lend_row = in_row1 + in_n_rows;
+  uword count    = 0;
 
-  for(uword i = m.col_ptrs[in_col1]; i < end; ++i)
+  for(uword i = m.col_ptrs[in_col1]; i < lend; ++i)
     {
-    if(m.row_indices[i] >= in_row1 && m.row_indices[i] < end_row)
+    if(m.row_indices[i] >= in_row1 && m.row_indices[i] < lend_row)
       {
       ++count;
       }
@@ -98,20 +98,19 @@
     return *this;
     }
 
-  const uword start_row = aux_row1;
-  const uword end_row   = aux_row1 + n_rows;
-  const uword start_col = aux_col1;
-  const uword end_col   = aux_col1 + n_cols;
+  const uword lstart_row = aux_row1;
+  const uword lend_row   = aux_row1 + n_rows;
+  
+  const uword lstart_col = aux_col1;
+  const uword lend_col   = aux_col1 + n_cols;
 
   const uword old_n_nonzero = m.n_nonzero;
 
   // iterate over our part of the sparse matrix
-  for(uword col = start_col; col < end_col; ++col)
+  for(uword lcol = lstart_col; lcol < lend_col; ++lcol)
+  for(uword lrow = lstart_row; lrow < lend_row; ++lrow)
     {
-    for(uword row = start_row; row < end_row; ++row)
-      {
-      access::rw(m).at(row, col) += val;
-      }
+    access::rw(m).at(lrow, lcol) += val;
     }
 
   const uword new_n_nonzero = m.n_nonzero;
@@ -135,19 +134,18 @@
     return *this;
     }
 
-  const uword start_row = aux_row1;
-  const uword end_row   = aux_row1 + n_rows;
-  const uword start_col = aux_col1;
-  const uword end_col   = aux_col1 + n_cols;
+  const uword lstart_row = aux_row1;
+  const uword lend_row   = aux_row1 + n_rows;
+  
+  const uword lstart_col = aux_col1;
+  const uword lend_col   = aux_col1 + n_cols;
 
   const uword old_n_nonzero = m.n_nonzero;
 
-  for(uword col = start_col; col < end_col; ++col)
+  for(uword lcol = lstart_col; lcol < lend_col; ++lcol)
[TRUNCATED]

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


More information about the Rcpp-commits mailing list