Skip to content

Commit 00d3bd7

Browse files
committed
Updated Eigen (OSX/Linux/Win) to 3.2.8
1 parent bf0282e commit 00d3bd7

File tree

144 files changed

+2887
-1432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2887
-1432
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Nuparu
22
======
33

4-
v0.1.16.16a
4+
v0.1.16.16c
55

66
Third Party dependencies and foundation libraries for Karl's graphics projects
77

@@ -13,7 +13,7 @@ Nuparu currently consists of:
1313
* [jsoncpp](http://sourceforge.net/projects/jsoncpp/) 0.10.5 (OSX/Win)
1414
* [stb_image](https://code.google.com/p/stblib/) 1.33 (OSX/Linux/Win)
1515
* [glslUtility](https://github.com/CIS565-Fall-2012/Project0-Cuda-Checker/blob/master/HW0_MAC/src/glslUtility.cpp) 1.2 (OSX/Linux/Win)
16-
* [Eigen](eigen.tuxfamily.org/) 3.2.0 (OSX/Linux/Win)
16+
* [Eigen](eigen.tuxfamily.org/) 3.2.8 (OSX/Linux/Win)
1717
* [OpenVDB](http://www.openvdb.org/) 2.3.0 (OSX/Win)
1818
* [Partio](http://www.disneyanimation.com/technology/partio.html) 1.1.0 (OSX/Win)
1919
* [RMSD](http://boscoh.com/code/) (OSX/Linux/Win)

include/Eigen/CholmodSupport

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212
/** \ingroup Support_modules
1313
* \defgroup CholmodSupport_Module CholmodSupport module
1414
*
15-
* This module provides an interface to the Cholmod library which is part of the <a href="http://www.cise.ufl.edu/research/sparse/SuiteSparse/">suitesparse</a> package.
15+
* This module provides an interface to the Cholmod library which is part of the <a href="http://www.suitesparse.com">suitesparse</a> package.
1616
* It provides the two following main factorization classes:
1717
* - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
1818
* - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).

include/Eigen/Core

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
extern "C" {
9696
// In theory we should only include immintrin.h and not the other *mmintrin.h header files directly.
9797
// Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus:
98-
#ifdef __INTEL_COMPILER
98+
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1110
9999
#include <immintrin.h>
100100
#else
101101
#include <emmintrin.h>
@@ -123,7 +123,7 @@
123123
#undef bool
124124
#undef vector
125125
#undef pixel
126-
#elif defined __ARM_NEON__
126+
#elif defined __ARM_NEON
127127
#define EIGEN_VECTORIZE
128128
#define EIGEN_VECTORIZE_NEON
129129
#include <arm_neon.h>
@@ -165,7 +165,7 @@
165165
#endif
166166

167167
// required for __cpuid, needs to be included after cmath
168-
#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64))
168+
#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) && (!defined(_WIN32_WCE))
169169
#include <intrin.h>
170170
#endif
171171

include/Eigen/Eigen2Support

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,25 @@
1414
#error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header
1515
#endif
1616

17+
#ifndef EIGEN_NO_EIGEN2_DEPRECATED_WARNING
18+
19+
#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)
20+
#warning "Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)"
21+
#else
22+
#pragma message ("Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)")
23+
#endif
24+
25+
#endif // EIGEN_NO_EIGEN2_DEPRECATED_WARNING
26+
1727
#include "src/Core/util/DisableStupidWarnings.h"
1828

1929
/** \ingroup Support_modules
2030
* \defgroup Eigen2Support_Module Eigen2 support module
21-
* This module provides a couple of deprecated functions improving the compatibility with Eigen2.
2231
*
32+
* \warning Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3.
33+
*
34+
* This module provides a couple of deprecated functions improving the compatibility with Eigen2.
35+
*
2336
* To use it, define EIGEN2_SUPPORT before including any Eigen header
2437
* \code
2538
* #define EIGEN2_SUPPORT

include/Eigen/SPQRSupport

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/** \ingroup Support_modules
1111
* \defgroup SPQRSupport_Module SuiteSparseQR module
1212
*
13-
* This module provides an interface to the SPQR library, which is part of the <a href="http://www.cise.ufl.edu/research/sparse/SuiteSparse/">suitesparse</a> package.
13+
* This module provides an interface to the SPQR library, which is part of the <a href="http://www.suitesparse.com">suitesparse</a> package.
1414
*
1515
* \code
1616
* #include <Eigen/SPQRSupport>

include/Eigen/SparseCore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* \defgroup SparseCore_Module SparseCore module
1616
*
17-
* This module provides a sparse matrix representation, and basic associatd matrix manipulations
17+
* This module provides a sparse matrix representation, and basic associated matrix manipulations
1818
* and operations.
1919
*
2020
* See the \ref TutorialSparse "Sparse tutorial"

include/Eigen/UmfPackSupport

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212
/** \ingroup Support_modules
1313
* \defgroup UmfPackSupport_Module UmfPackSupport module
1414
*
15-
* This module provides an interface to the UmfPack library which is part of the <a href="http://www.cise.ufl.edu/research/sparse/SuiteSparse/">suitesparse</a> package.
15+
* This module provides an interface to the UmfPack library which is part of the <a href="http://www.suitesparse.com">suitesparse</a> package.
1616
* It provides the following factorization class:
1717
* - class UmfPackLU: a multifrontal sequential LU factorization.
1818
*

include/Eigen/src/Cholesky/LDLT.h

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
namespace Eigen {
1717

1818
namespace internal {
19-
template<typename MatrixType, int UpLo> struct LDLT_Traits;
19+
template<typename MatrixType, int UpLo> struct LDLT_Traits;
20+
21+
// PositiveSemiDef means positive semi-definite and non-zero; same for NegativeSemiDef
22+
enum SignMatrix { PositiveSemiDef, NegativeSemiDef, ZeroSign, Indefinite };
2023
}
2124

2225
/** \ingroup Cholesky_Module
@@ -69,7 +72,12 @@ template<typename _MatrixType, int _UpLo> class LDLT
6972
* The default constructor is useful in cases in which the user intends to
7073
* perform decompositions via LDLT::compute(const MatrixType&).
7174
*/
72-
LDLT() : m_matrix(), m_transpositions(), m_isInitialized(false) {}
75+
LDLT()
76+
: m_matrix(),
77+
m_transpositions(),
78+
m_sign(internal::ZeroSign),
79+
m_isInitialized(false)
80+
{}
7381

7482
/** \brief Default Constructor with memory preallocation
7583
*
@@ -81,6 +89,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
8189
: m_matrix(size, size),
8290
m_transpositions(size),
8391
m_temporary(size),
92+
m_sign(internal::ZeroSign),
8493
m_isInitialized(false)
8594
{}
8695

@@ -93,6 +102,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
93102
: m_matrix(matrix.rows(), matrix.cols()),
94103
m_transpositions(matrix.rows()),
95104
m_temporary(matrix.rows()),
105+
m_sign(internal::ZeroSign),
96106
m_isInitialized(false)
97107
{
98108
compute(matrix);
@@ -139,7 +149,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
139149
inline bool isPositive() const
140150
{
141151
eigen_assert(m_isInitialized && "LDLT is not initialized.");
142-
return m_sign == 1;
152+
return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign;
143153
}
144154

145155
#ifdef EIGEN2_SUPPORT
@@ -153,7 +163,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
153163
inline bool isNegative(void) const
154164
{
155165
eigen_assert(m_isInitialized && "LDLT is not initialized.");
156-
return m_sign == -1;
166+
return m_sign == internal::NegativeSemiDef || m_sign == internal::ZeroSign;
157167
}
158168

159169
/** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A.
@@ -225,6 +235,11 @@ template<typename _MatrixType, int _UpLo> class LDLT
225235
}
226236

227237
protected:
238+
239+
static void check_template_parameters()
240+
{
241+
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
242+
}
228243

229244
/** \internal
230245
* Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U.
@@ -235,7 +250,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
235250
MatrixType m_matrix;
236251
TranspositionType m_transpositions;
237252
TmpMatrixType m_temporary;
238-
int m_sign;
253+
internal::SignMatrix m_sign;
239254
bool m_isInitialized;
240255
};
241256

@@ -246,7 +261,7 @@ template<int UpLo> struct ldlt_inplace;
246261
template<> struct ldlt_inplace<Lower>
247262
{
248263
template<typename MatrixType, typename TranspositionType, typename Workspace>
249-
static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0)
264+
static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign)
250265
{
251266
using std::abs;
252267
typedef typename MatrixType::Scalar Scalar;
@@ -258,36 +273,19 @@ template<> struct ldlt_inplace<Lower>
258273
if (size <= 1)
259274
{
260275
transpositions.setIdentity();
261-
if(sign)
262-
*sign = numext::real(mat.coeff(0,0))>0 ? 1:-1;
276+
if (numext::real(mat.coeff(0,0)) > 0) sign = PositiveSemiDef;
277+
else if (numext::real(mat.coeff(0,0)) < 0) sign = NegativeSemiDef;
278+
else sign = ZeroSign;
263279
return true;
264280
}
265281

266-
RealScalar cutoff(0), biggest_in_corner;
267-
268282
for (Index k = 0; k < size; ++k)
269283
{
270284
// Find largest diagonal element
271285
Index index_of_biggest_in_corner;
272-
biggest_in_corner = mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
286+
mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
273287
index_of_biggest_in_corner += k;
274288

275-
if(k == 0)
276-
{
277-
// The biggest overall is the point of reference to which further diagonals
278-
// are compared; if any diagonal is negligible compared
279-
// to the largest overall, the algorithm bails.
280-
cutoff = abs(NumTraits<Scalar>::epsilon() * biggest_in_corner);
281-
}
282-
283-
// Finish early if the matrix is not full rank.
284-
if(biggest_in_corner < cutoff)
285-
{
286-
for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i;
287-
if(sign) *sign = 0;
288-
break;
289-
}
290-
291289
transpositions.coeffRef(k) = index_of_biggest_in_corner;
292290
if(k != index_of_biggest_in_corner)
293291
{
@@ -318,22 +316,27 @@ template<> struct ldlt_inplace<Lower>
318316

319317
if(k>0)
320318
{
321-
temp.head(k) = mat.diagonal().head(k).asDiagonal() * A10.adjoint();
319+
temp.head(k) = mat.diagonal().real().head(k).asDiagonal() * A10.adjoint();
322320
mat.coeffRef(k,k) -= (A10 * temp.head(k)).value();
323321
if(rs>0)
324322
A21.noalias() -= A20 * temp.head(k);
325323
}
326-
if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff))
327-
A21 /= mat.coeffRef(k,k);
328324

329-
if(sign)
330-
{
331-
// LDLT is not guaranteed to work for indefinite matrices, but let's try to get the sign right
332-
int newSign = numext::real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0;
333-
if(k == 0)
334-
*sign = newSign;
335-
else if(*sign != newSign)
336-
*sign = 0;
325+
// In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot
326+
// was smaller than the cutoff value. However, soince LDLT is not rank-revealing
327+
// we should only make sure we do not introduce INF or NaN values.
328+
// LAPACK also uses 0 as the cutoff value.
329+
RealScalar realAkk = numext::real(mat.coeffRef(k,k));
330+
if((rs>0) && (abs(realAkk) > RealScalar(0)))
331+
A21 /= realAkk;
332+
333+
if (sign == PositiveSemiDef) {
334+
if (realAkk < 0) sign = Indefinite;
335+
} else if (sign == NegativeSemiDef) {
336+
if (realAkk > 0) sign = Indefinite;
337+
} else if (sign == ZeroSign) {
338+
if (realAkk > 0) sign = PositiveSemiDef;
339+
else if (realAkk < 0) sign = NegativeSemiDef;
337340
}
338341
}
339342

@@ -399,7 +402,7 @@ template<> struct ldlt_inplace<Lower>
399402
template<> struct ldlt_inplace<Upper>
400403
{
401404
template<typename MatrixType, typename TranspositionType, typename Workspace>
402-
static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0)
405+
static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign)
403406
{
404407
Transpose<MatrixType> matt(mat);
405408
return ldlt_inplace<Lower>::unblocked(matt, transpositions, temp, sign);
@@ -436,6 +439,8 @@ template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
436439
template<typename MatrixType, int _UpLo>
437440
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
438441
{
442+
check_template_parameters();
443+
439444
eigen_assert(a.rows()==a.cols());
440445
const Index size = a.rows();
441446

@@ -444,8 +449,9 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
444449
m_transpositions.resize(size);
445450
m_isInitialized = false;
446451
m_temporary.resize(size);
452+
m_sign = internal::ZeroSign;
447453

448-
internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, &m_sign);
454+
internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, m_sign);
449455

450456
m_isInitialized = true;
451457
return *this;
@@ -458,7 +464,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
458464
*/
459465
template<typename MatrixType, int _UpLo>
460466
template<typename Derived>
461-
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename NumTraits<typename MatrixType::Scalar>::Real& sigma)
467+
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename LDLT<MatrixType,_UpLo>::RealScalar& sigma)
462468
{
463469
const Index size = w.rows();
464470
if (m_isInitialized)
@@ -473,7 +479,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Deri
473479
for (Index i = 0; i < size; i++)
474480
m_transpositions.coeffRef(i) = i;
475481
m_temporary.resize(size);
476-
m_sign = sigma>=0 ? 1 : -1;
482+
m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef;
477483
m_isInitialized = true;
478484
}
479485

@@ -504,16 +510,21 @@ struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
504510
using std::abs;
505511
using std::max;
506512
typedef typename LDLTType::MatrixType MatrixType;
507-
typedef typename LDLTType::Scalar Scalar;
508513
typedef typename LDLTType::RealScalar RealScalar;
509-
const Diagonal<const MatrixType> vectorD = dec().vectorD();
510-
RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() * NumTraits<Scalar>::epsilon(),
511-
RealScalar(1) / NumTraits<RealScalar>::highest()); // motivated by LAPACK's xGELSS
514+
const typename Diagonal<const MatrixType>::RealReturnType vectorD(dec().vectorD());
515+
// In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon
516+
// as motivated by LAPACK's xGELSS:
517+
// RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() *NumTraits<RealScalar>::epsilon(),RealScalar(1) / NumTraits<RealScalar>::highest());
518+
// However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest
519+
// diagonal element is not well justified and to numerical issues in some cases.
520+
// Moreover, Lapack's xSYTRS routines use 0 for the tolerance.
521+
RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();
522+
512523
for (Index i = 0; i < vectorD.size(); ++i) {
513524
if(abs(vectorD(i)) > tolerance)
514-
dst.row(i) /= vectorD(i);
525+
dst.row(i) /= vectorD(i);
515526
else
516-
dst.row(i).setZero();
527+
dst.row(i).setZero();
517528
}
518529

519530
// dst = L^-T (D^-1 L^-1 P b)
@@ -566,7 +577,7 @@ MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const
566577
// L^* P
567578
res = matrixU() * res;
568579
// D(L^*P)
569-
res = vectorD().asDiagonal() * res;
580+
res = vectorD().real().asDiagonal() * res;
570581
// L(DL^*P)
571582
res = matrixL() * res;
572583
// P^T (LDL^*P)

include/Eigen/src/Cholesky/LLT.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ template<typename _MatrixType, int _UpLo> class LLT
174174
LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1);
175175

176176
protected:
177+
178+
static void check_template_parameters()
179+
{
180+
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
181+
}
182+
177183
/** \internal
178184
* Used to compute and store L
179185
* The strict upper part is not used and even not initialized.
@@ -283,7 +289,7 @@ template<typename Scalar> struct llt_inplace<Scalar, Lower>
283289
return k;
284290
mat.coeffRef(k,k) = x = sqrt(x);
285291
if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
286-
if (rs>0) A21 *= RealScalar(1)/x;
292+
if (rs>0) A21 /= x;
287293
}
288294
return -1;
289295
}
@@ -384,6 +390,8 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
384390
template<typename MatrixType, int _UpLo>
385391
LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
386392
{
393+
check_template_parameters();
394+
387395
eigen_assert(a.rows()==a.cols());
388396
const Index size = a.rows();
389397
m_matrix.resize(size, size);

0 commit comments

Comments
 (0)