[Bf-blender-cvs] [9ad13d7] master: Update Eigen to version 3.2.7

Martijn Berger noreply at git.blender.org
Thu Dec 10 12:39:57 CET 2015


Commit: 9ad13d70faff0c510c313a7d58a58b974e8ce11f
Author: Martijn Berger
Date:   Thu Dec 10 12:37:46 2015 +0100
Branches: master
https://developer.blender.org/rB9ad13d70faff0c510c313a7d58a58b974e8ce11f

Update Eigen to version 3.2.7

The main purpose of this is to get MSVC 2015 fixes

===================================================================

M	extern/Eigen3/Eigen/Core
M	extern/Eigen3/Eigen/SparseCore
M	extern/Eigen3/Eigen/src/Cholesky/LDLT.h
M	extern/Eigen3/Eigen/src/Cholesky/LLT.h
M	extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
M	extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
M	extern/Eigen3/Eigen/src/Core/Array.h
M	extern/Eigen3/Eigen/src/Core/ArrayBase.h
M	extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
M	extern/Eigen3/Eigen/src/Core/Assign.h
M	extern/Eigen3/Eigen/src/Core/Block.h
M	extern/Eigen3/Eigen/src/Core/CommaInitializer.h
M	extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h
M	extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h
M	extern/Eigen3/Eigen/src/Core/DenseBase.h
M	extern/Eigen3/Eigen/src/Core/DenseStorage.h
M	extern/Eigen3/Eigen/src/Core/Diagonal.h
M	extern/Eigen3/Eigen/src/Core/DiagonalProduct.h
M	extern/Eigen3/Eigen/src/Core/Functors.h
M	extern/Eigen3/Eigen/src/Core/GeneralProduct.h
M	extern/Eigen3/Eigen/src/Core/MapBase.h
M	extern/Eigen3/Eigen/src/Core/MathFunctions.h
M	extern/Eigen3/Eigen/src/Core/Matrix.h
M	extern/Eigen3/Eigen/src/Core/MatrixBase.h
M	extern/Eigen3/Eigen/src/Core/PermutationMatrix.h
M	extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
M	extern/Eigen3/Eigen/src/Core/ProductBase.h
M	extern/Eigen3/Eigen/src/Core/Redux.h
M	extern/Eigen3/Eigen/src/Core/Ref.h
M	extern/Eigen3/Eigen/src/Core/Replicate.h
M	extern/Eigen3/Eigen/src/Core/ReturnByValue.h
M	extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h
M	extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
M	extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h
M	extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h
M	extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h
M	extern/Eigen3/Eigen/src/Core/products/CoeffBasedProduct.h
M	extern/Eigen3/Eigen/src/Core/products/Parallelizer.h
M	extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h
M	extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h
M	extern/Eigen3/Eigen/src/Core/util/Constants.h
M	extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h
M	extern/Eigen3/Eigen/src/Core/util/MKL_support.h
M	extern/Eigen3/Eigen/src/Core/util/Macros.h
M	extern/Eigen3/Eigen/src/Core/util/Memory.h
M	extern/Eigen3/Eigen/src/Core/util/StaticAssert.h
M	extern/Eigen3/Eigen/src/Core/util/XprHelper.h
M	extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
M	extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h
M	extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h
M	extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h
M	extern/Eigen3/Eigen/src/Eigenvalues/RealQZ.h
M	extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h
M	extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
M	extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
M	extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
M	extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
M	extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
M	extern/Eigen3/Eigen/src/Geometry/Quaternion.h
M	extern/Eigen3/Eigen/src/Geometry/Rotation2D.h
M	extern/Eigen3/Eigen/src/Geometry/Transform.h
M	extern/Eigen3/Eigen/src/Geometry/Umeyama.h
M	extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h
M	extern/Eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
M	extern/Eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h
M	extern/Eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
M	extern/Eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h
M	extern/Eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
M	extern/Eigen3/Eigen/src/LU/FullPivLU.h
M	extern/Eigen3/Eigen/src/LU/PartialPivLU.h
M	extern/Eigen3/Eigen/src/OrderingMethods/Amd.h
M	extern/Eigen3/Eigen/src/OrderingMethods/Ordering.h
M	extern/Eigen3/Eigen/src/PardisoSupport/PardisoSupport.h
M	extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h
M	extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h
M	extern/Eigen3/Eigen/src/QR/HouseholderQR.h
M	extern/Eigen3/Eigen/src/QR/HouseholderQR_MKL.h
M	extern/Eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h
M	extern/Eigen3/Eigen/src/SVD/JacobiSVD.h
M	extern/Eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h
M	extern/Eigen3/Eigen/src/SparseCore/AmbiVector.h
M	extern/Eigen3/Eigen/src/SparseCore/CompressedStorage.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseBlock.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseDenseProduct.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseMatrix.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h
M	extern/Eigen3/Eigen/src/SparseCore/SparsePermutation.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseTranspose.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseUtil.h
M	extern/Eigen3/Eigen/src/SparseCore/SparseVector.h
M	extern/Eigen3/Eigen/src/SparseCore/TriangularSolver.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLUImpl.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU_Memory.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h
M	extern/Eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h
M	extern/Eigen3/Eigen/src/SparseQR/SparseQR.h
M	extern/Eigen3/Eigen/src/StlSupport/StdDeque.h
M	extern/Eigen3/Eigen/src/StlSupport/StdList.h
M	extern/Eigen3/Eigen/src/StlSupport/StdVector.h
M	extern/Eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h
M	extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h
M	extern/Eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h
M	extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h
M	extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h
M	extern/Eigen3/eigen-update.sh

===================================================================

diff --git a/extern/Eigen3/Eigen/Core b/extern/Eigen3/Eigen/Core
index 9131cc3..509c529 100644
--- a/extern/Eigen3/Eigen/Core
+++ b/extern/Eigen3/Eigen/Core
@@ -95,7 +95,7 @@
     extern "C" {
       // In theory we should only include immintrin.h and not the other *mmintrin.h header files directly.
       // Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus:
-      #ifdef __INTEL_COMPILER
+      #if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1110
         #include <immintrin.h>
       #else
         #include <emmintrin.h>
@@ -123,7 +123,7 @@
     #undef bool
     #undef vector
     #undef pixel
-  #elif defined  __ARM_NEON__
+  #elif defined  __ARM_NEON
     #define EIGEN_VECTORIZE
     #define EIGEN_VECTORIZE_NEON
     #include <arm_neon.h>
@@ -165,7 +165,7 @@
 #endif
 
 // required for __cpuid, needs to be included after cmath
-#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64))
+#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) && (!defined(_WIN32_WCE))
   #include <intrin.h>
 #endif
 
diff --git a/extern/Eigen3/Eigen/SparseCore b/extern/Eigen3/Eigen/SparseCore
index 9b5be5e..24bcf01 100644
--- a/extern/Eigen3/Eigen/SparseCore
+++ b/extern/Eigen3/Eigen/SparseCore
@@ -14,7 +14,7 @@
 /** 
   * \defgroup SparseCore_Module SparseCore module
   *
-  * This module provides a sparse matrix representation, and basic associatd matrix manipulations
+  * This module provides a sparse matrix representation, and basic associated matrix manipulations
   * and operations.
   *
   * See the \ref TutorialSparse "Sparse tutorial"
diff --git a/extern/Eigen3/Eigen/src/Cholesky/LDLT.h b/extern/Eigen3/Eigen/src/Cholesky/LDLT.h
index d026418..abd30bd 100644
--- a/extern/Eigen3/Eigen/src/Cholesky/LDLT.h
+++ b/extern/Eigen3/Eigen/src/Cholesky/LDLT.h
@@ -235,6 +235,11 @@ template<typename _MatrixType, int _UpLo> class LDLT
     }
 
   protected:
+    
+    static void check_template_parameters()
+    {
+      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
+    }
 
     /** \internal
       * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U.
@@ -274,30 +279,13 @@ template<> struct ldlt_inplace<Lower>
       return true;
     }
 
-    RealScalar cutoff(0), biggest_in_corner;
-
     for (Index k = 0; k < size; ++k)
     {
       // Find largest diagonal element
       Index index_of_biggest_in_corner;
-      biggest_in_corner = mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
+      mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
       index_of_biggest_in_corner += k;
 
-      if(k == 0)
-      {
-        // The biggest overall is the point of reference to which further diagonals
-        // are compared; if any diagonal is negligible compared
-        // to the largest overall, the algorithm bails.
-        cutoff = abs(NumTraits<Scalar>::epsilon() * biggest_in_corner);
-      }
-
-      // Finish early if the matrix is not full rank.
-      if(biggest_in_corner < cutoff)
-      {
-        for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i;
-        break;
-      }
-
       transpositions.coeffRef(k) = index_of_biggest_in_corner;
       if(k != index_of_biggest_in_corner)
       {
@@ -328,15 +316,20 @@ template<> struct ldlt_inplace<Lower>
 
       if(k>0)
       {
-        temp.head(k) = mat.diagonal().head(k).asDiagonal() * A10.adjoint();
+        temp.head(k) = mat.diagonal().real().head(k).asDiagonal() * A10.adjoint();
         mat.coeffRef(k,k) -= (A10 * temp.head(k)).value();
         if(rs>0)
           A21.noalias() -= A20 * temp.head(k);
       }
-      if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff))
-        A21 /= mat.coeffRef(k,k);
-
+      
+      // In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot
+      // was smaller than the cutoff value. However, soince LDLT is not rank-revealing
+      // we should only make sure we do not introduce INF or NaN values.
+      // LAPACK also uses 0 as the cutoff value.
       RealScalar realAkk = numext::real(mat.coeffRef(k,k));
+      if((rs>0) && (abs(realAkk) > RealScalar(0)))
+        A21 /= realAkk;
+
       if (sign == PositiveSemiDef) {
         if (realAkk < 0) sign = Indefinite;
       } else if (sign == NegativeSemiDef) {
@@ -446,6 +439,8 @@ template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
 template<typename MatrixType, int _UpLo>
 LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
 {
+  check_template_parameters();
+  
   eigen_assert(a.rows()==a.cols());
   const Index size = a.rows();
 
@@ -454,6 +449,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
   m_transpositions.resize(size);
   m_isInitialized = false;
   m_temporary.resize(size);
+  m_sign = internal::ZeroSign;
 
   internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, m_sign);
 
@@ -468,7 +464,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
   */
 template<typename MatrixType, int _UpLo>
 template<typename Derived>
-LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename NumTraits<typename MatrixType::Scalar>::Real& sigma)
+LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename LDLT<MatrixType,_UpLo>::RealScalar& sigma)
 {
   const Index size = w.rows();
   if (m_isInitialized)
@@ -514,16 +510,21 @@ struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
     using std::abs;
     using std::max;
     typedef typename LDLTType::MatrixType MatrixType;
-    typedef typename LDLTType::Scalar Scalar;
     typedef typename LDLTType::RealScalar RealScalar;
-    const Diagonal<const MatrixType> vectorD = dec().vectorD();
-    RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() * NumTraits<Scalar>::epsilon(),
-				 RealScalar(1) / NumTraits<RealScalar>::highest()); // motivated by LAPACK's xGELSS
+    const typename Diagonal<const MatrixType>::RealReturnType vectorD(dec().vectorD());
+    // In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon
+    // as motivated by LAPACK's xGELSS:
+    // RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() *NumTraits<RealScalar>::epsilon(),RealScalar(1) / NumTraits<RealScalar>::highest());
+    // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest
+    // diagonal element is not well justified and to numerical issues in some cases.
+    // Moreover, Lapack's xSYTRS routines use 0 for the tolerance.
+    RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();
+    
     for (Index i = 0; i < vectorD.size(); ++i) {
       if(abs(vectorD(i)) > tolerance)
-	dst.row(i) /= vectorD(i);
+        dst.row(i) /= vectorD(i);
       else
-	dst.row(i).setZero();
+        dst.row(i).setZero();
     }
 
     // dst = L^-T (D^-1 L^-1 P b)
@@ -576,7 +577,7 @@ MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const
   // L^* P
   res = matrixU() * res;
   // D(L^*P)
-  res = vectorD().asDiagonal() * res;
+  res = vectorD().real().asDiagonal() * res;
   // L(DL^*P)
   res = matrixL() * res;
   // P^T (LDL^*P)
diff --git a/extern/Eigen3/Eigen/src/Cholesky/LLT.h b/extern/Eigen3/Eigen/src/Cholesky/LLT.h
index 2e6189f..7c11a2d 100644
--- a/extern/Eigen3/Eigen/src/Cholesky/LLT.h
+++ b/extern/Eigen3/Eigen/src/Cholesky/LLT.h
@@ -174,6 +174,12 @@ template<typename _MatrixType, int _UpLo> class LLT
     LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1);
 
   protected:
+    
+    static void check_template_parameters()
+    {
+      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
+    }
+    
     /** \internal
       * Used to compute and store L
       * The strict upper part is not used and even not initialized.
@@ -283,7 +289,7 @@ template<typename Scalar> struct llt_inplace<Scalar, Lower>
         return k;
       mat.coeffRef(k,k) = x = sqrt(x);
       if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
-      if (rs>0) A21 *= RealScalar(1)/x;
+      if (rs>0) A21 /= x;
     }
     return -1;
   }
@@ -384,6 +390,8 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
 template<typename MatrixType, int _UpLo>
 LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
 {
+  check_template_parameters();
+  
   eigen_assert(a.rows()==a.cols());
   const Index size = a.rows();
   m_matrix.resize(size, size);
diff --git a/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h b/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
index 64daa44..66675d7 100644
--- a/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
+++ b/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
@@ -60,7 +60,7 @@ template<> struct mkl_llt<EIGTYPE> \
     lda = m.outerStride(); \
 \
     info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \
-    info = (info==0) ? Success : NumericalIssue; \
+    info = (info==0) ? -1 : info>0 ? info-1 : size; \
     return info; \
   } \
 }; \
diff --git a/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h b/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
index c449960..99dbe17 100644
--- a/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
+++ b/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
@@ -78,7 +78,7 @@ cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat)
   {
     res.itype = CHOLMOD_INT;
   }
-  else if (internal::is_same<_Index,UF_long>::value)
+  else if (internal::is_same<_Index,SuiteSparse_long>::value)
   {
     res.itype = CHOLMOD_LONG;
   }
@@ -395,7 +395,7 @@ class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimpl
     CholmodSimplicialLLT(const MatrixType& matrix) : Base()
     {
       init();
-      compute(matrix);
+      Base::compute(matrix);
     }
 
     ~CholmodSimplicialLLT() {}
@@ -442,7 +442,7 @@ class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimp
     CholmodSimplicialLDLT(const MatrixType& matrix) : Base()
     {
       init();
-      compute(matrix);
+      Base::compute(matrix);
     }
 
     ~CholmodSimplicial

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list