Squashed 'third_party/eigen/' changes from 61d72f6..cf794d3


Change-Id: I9b814151b01f49af6337a8605d0c42a3a1ed4c72
git-subtree-dir: third_party/eigen
git-subtree-split: cf794d3b741a6278df169e58461f8529f43bce5d
diff --git a/Eigen/src/MetisSupport/MetisSupport.h b/Eigen/src/MetisSupport/MetisSupport.h
index f2bbef2..4c15304 100644
--- a/Eigen/src/MetisSupport/MetisSupport.h
+++ b/Eigen/src/MetisSupport/MetisSupport.h
@@ -18,12 +18,12 @@
  * Row (column) i of A is the matperm(i) row (column) of Ap. 
  * WARNING: As computed by METIS, this corresponds to the vector iperm (instead of perm)
  */
-template <typename Index>
+template <typename StorageIndex>
 class MetisOrdering
 {
 public:
-  typedef PermutationMatrix<Dynamic,Dynamic,Index> PermutationType;
-  typedef Matrix<Index,Dynamic,1> IndexVector; 
+  typedef PermutationMatrix<Dynamic,Dynamic,StorageIndex> PermutationType;
+  typedef Matrix<StorageIndex,Dynamic,1> IndexVector; 
   
   template <typename MatrixType>
   void get_symmetrized_graph(const MatrixType& A)
@@ -36,7 +36,7 @@
     Index TotNz = 0; 
     IndexVector visited(m); 
     visited.setConstant(-1); 
-    for (int j = 0; j < m; j++)
+    for (StorageIndex j = 0; j < m; j++)
     {
       // Compute the union structure of of A(j,:) and At(j,:)
       visited(j) = j; // Do not include the diagonal element
@@ -67,8 +67,8 @@
 
     // Now compute the real adjacency list of each column/row 
     visited.setConstant(-1); 
-    Index CurNz = 0; 
-    for (int j = 0; j < m; j++)
+    StorageIndex CurNz = 0; 
+    for (StorageIndex j = 0; j < m; j++)
     {
       m_indexPtr(j) = CurNz; 
       
@@ -76,7 +76,7 @@
       // Add the pattern of row/column j of A to A+At
       for (typename MatrixType::InnerIterator it(A,j); it; ++it)
       {
-        Index idx = it.index(); // Get the row index (for column major) or column index (for row major)
+        StorageIndex idx = it.index(); // Get the row index (for column major) or column index (for row major)
         if (visited(idx) != j ) 
         {
           visited(idx) = j; 
@@ -87,7 +87,7 @@
       //Add the pattern of row/column j of At to A+At
       for (typename MatrixType::InnerIterator it(At, j); it; ++it)
       {
-        Index idx = it.index(); 
+        StorageIndex idx = it.index(); 
         if(visited(idx) != j)
         {
           visited(idx) = j; 
@@ -102,7 +102,7 @@
   template <typename MatrixType>
   void operator() (const MatrixType& A, PermutationType& matperm)
   {
-     Index m = A.cols();
+     StorageIndex m = internal::convert_index<StorageIndex>(A.cols()); // must be StorageIndex, because it is passed by address to METIS
      IndexVector perm(m),iperm(m); 
     // First, symmetrize the matrix graph. 
      get_symmetrized_graph(A);