Skip to content

Commit 10fb88b

Browse files
committed
- update to Eigen 3.3.7
1 parent 9fe2b88 commit 10fb88b

File tree

94 files changed

+1300
-868
lines changed

Some content is hidden

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

94 files changed

+1300
-868
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- update to Eigen 3.3.7
2+
13
1.7.0
24
- added DamperJoint
35
- improved implementation of SliderJoint

extern/eigen/CMakeLists.txt

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_
4141
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
4242
set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})
4343

44-
# if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty,
45-
# but won't stop CMake.
46-
execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT)
47-
execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT)
44+
# if we are not in a mercurial clone
45+
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.hg)
46+
# if the mercurial program is absent or this will leave the EIGEN_HG_CHANGESET string empty,
47+
# but won't stop CMake.
48+
execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT)
49+
execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT)
50+
endif()
4851

4952
# if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output...
5053
if(EIGEN_BRANCH_OUTPUT MATCHES "default")
@@ -64,6 +67,33 @@ include(GNUInstallDirs)
6467

6568
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
6669

70+
71+
option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF)
72+
73+
74+
macro(ei_add_cxx_compiler_flag FLAG)
75+
string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})
76+
string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})
77+
check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})
78+
if(COMPILER_SUPPORT_${SFLAG})
79+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
80+
endif()
81+
endmacro(ei_add_cxx_compiler_flag)
82+
83+
check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)
84+
85+
if(EIGEN_TEST_CXX11)
86+
set(CMAKE_CXX_STANDARD 11)
87+
set(CMAKE_CXX_EXTENSIONS OFF)
88+
if(EIGEN_COMPILER_SUPPORT_CPP11)
89+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
90+
endif()
91+
else()
92+
#set(CMAKE_CXX_STANDARD 03)
93+
#set(CMAKE_CXX_EXTENSIONS OFF)
94+
ei_add_cxx_compiler_flag("-std=c++03")
95+
endif()
96+
6797
#############################################################################
6898
# find how to link to the standard libraries #
6999
#############################################################################
@@ -115,15 +145,6 @@ endif()
115145

116146
set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320")
117147

118-
macro(ei_add_cxx_compiler_flag FLAG)
119-
string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})
120-
string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})
121-
check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})
122-
if(COMPILER_SUPPORT_${SFLAG})
123-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
124-
endif()
125-
endmacro(ei_add_cxx_compiler_flag)
126-
127148
if(NOT MSVC)
128149
# We assume that other compilers are partly compatible with GNUCC
129150

@@ -359,8 +380,6 @@ if(EIGEN_TEST_NO_EXCEPTIONS)
359380
message(STATUS "Disabling exceptions in tests/examples")
360381
endif()
361382

362-
option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF)
363-
364383
set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code")
365384

366385
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
@@ -416,16 +435,15 @@ add_subdirectory(Eigen)
416435

417436
add_subdirectory(doc EXCLUDE_FROM_ALL)
418437

419-
include(EigenConfigureTesting)
420-
421-
# fixme, not sure this line is still needed:
422-
enable_testing() # must be called from the root CMakeLists, see man page
438+
option(BUILD_TESTING "Enable creation of Eigen tests." ON)
439+
if(BUILD_TESTING)
440+
include(EigenConfigureTesting)
423441

424-
425-
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
426-
add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
427-
else()
428-
add_subdirectory(test EXCLUDE_FROM_ALL)
442+
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
443+
add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
444+
else()
445+
add_subdirectory(test EXCLUDE_FROM_ALL)
446+
endif()
429447
endif()
430448

431449
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
@@ -461,7 +479,9 @@ endif(NOT WIN32)
461479

462480
configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY)
463481

464-
ei_testing_print_summary()
482+
if(BUILD_TESTING)
483+
ei_testing_print_summary()
484+
endif()
465485

466486
message(STATUS "")
467487
message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}")

extern/eigen/Eigen/Cholesky

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define EIGEN_CHOLESKY_MODULE_H
1010

1111
#include "Core"
12+
#include "Jacobi"
1213

1314
#include "src/Core/util/DisableStupidWarnings.h"
1415

@@ -31,7 +32,11 @@
3132
#include "src/Cholesky/LLT.h"
3233
#include "src/Cholesky/LDLT.h"
3334
#ifdef EIGEN_USE_LAPACKE
35+
#ifdef EIGEN_USE_MKL
36+
#include "mkl_lapacke.h"
37+
#else
3438
#include "src/misc/lapacke.h"
39+
#endif
3540
#include "src/Cholesky/LLT_LAPACKE.h"
3641
#endif
3742

extern/eigen/Eigen/Core

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
// first thing Eigen does: stop the compiler from committing suicide
1515
#include "src/Core/util/DisableStupidWarnings.h"
1616

17+
#if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
18+
#define EIGEN_CUDACC __CUDACC__
19+
#endif
20+
21+
#if defined(__CUDA_ARCH__) && !defined(EIGEN_NO_CUDA)
22+
#define EIGEN_CUDA_ARCH __CUDA_ARCH__
23+
#endif
24+
25+
#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
26+
#define EIGEN_CUDACC_VER ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
27+
#elif defined(__CUDACC_VER__)
28+
#define EIGEN_CUDACC_VER __CUDACC_VER__
29+
#else
30+
#define EIGEN_CUDACC_VER 0
31+
#endif
32+
1733
// Handle NVCC/CUDA/SYCL
1834
#if defined(__CUDACC__) || defined(__SYCL_DEVICE_ONLY__)
1935
// Do not try asserts on CUDA and SYCL!
@@ -37,9 +53,9 @@
3753
#endif
3854

3955
#define EIGEN_DEVICE_FUNC __host__ __device__
40-
// We need math_functions.hpp to ensure that that EIGEN_USING_STD_MATH macro
56+
// We need cuda_runtime.h to ensure that that EIGEN_USING_STD_MATH macro
4157
// works properly on the device side
42-
#include <math_functions.hpp>
58+
#include <cuda_runtime.h>
4359
#else
4460
#define EIGEN_DEVICE_FUNC
4561
#endif
@@ -155,6 +171,9 @@
155171
#ifdef __AVX512DQ__
156172
#define EIGEN_VECTORIZE_AVX512DQ
157173
#endif
174+
#ifdef __AVX512ER__
175+
#define EIGEN_VECTORIZE_AVX512ER
176+
#endif
158177
#endif
159178

160179
// include files
@@ -229,7 +248,7 @@
229248
#if defined __CUDACC__
230249
#define EIGEN_VECTORIZE_CUDA
231250
#include <vector_types.h>
232-
#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500
251+
#if EIGEN_CUDACC_VER >= 70500
233252
#define EIGEN_HAS_CUDA_FP16
234253
#endif
235254
#endif
@@ -352,6 +371,7 @@ using std::ptrdiff_t;
352371
#include "src/Core/MathFunctions.h"
353372
#include "src/Core/GenericPacketMath.h"
354373
#include "src/Core/MathFunctionsImpl.h"
374+
#include "src/Core/arch/Default/ConjHelper.h"
355375

356376
#if defined EIGEN_VECTORIZE_AVX512
357377
#include "src/Core/arch/SSE/PacketMath.h"
@@ -367,6 +387,7 @@ using std::ptrdiff_t;
367387
#include "src/Core/arch/AVX/MathFunctions.h"
368388
#include "src/Core/arch/AVX/Complex.h"
369389
#include "src/Core/arch/AVX/TypeCasting.h"
390+
#include "src/Core/arch/SSE/TypeCasting.h"
370391
#elif defined EIGEN_VECTORIZE_SSE
371392
#include "src/Core/arch/SSE/PacketMath.h"
372393
#include "src/Core/arch/SSE/MathFunctions.h"

extern/eigen/Eigen/Eigenvalues

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
#include "src/Eigenvalues/GeneralizedEigenSolver.h"
4646
#include "src/Eigenvalues/MatrixBaseEigenvalues.h"
4747
#ifdef EIGEN_USE_LAPACKE
48+
#ifdef EIGEN_USE_MKL
49+
#include "mkl_lapacke.h"
50+
#else
4851
#include "src/misc/lapacke.h"
52+
#endif
4953
#include "src/Eigenvalues/RealSchur_LAPACKE.h"
5054
#include "src/Eigenvalues/ComplexSchur_LAPACKE.h"
5155
#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h"

extern/eigen/Eigen/LU

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
#include "src/LU/FullPivLU.h"
2929
#include "src/LU/PartialPivLU.h"
3030
#ifdef EIGEN_USE_LAPACKE
31+
#ifdef EIGEN_USE_MKL
32+
#include "mkl_lapacke.h"
33+
#else
3134
#include "src/misc/lapacke.h"
35+
#endif
3236
#include "src/LU/PartialPivLU_LAPACKE.h"
3337
#endif
3438
#include "src/LU/Determinant.h"

extern/eigen/Eigen/QR

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@
3636
#include "src/QR/ColPivHouseholderQR.h"
3737
#include "src/QR/CompleteOrthogonalDecomposition.h"
3838
#ifdef EIGEN_USE_LAPACKE
39+
#ifdef EIGEN_USE_MKL
40+
#include "mkl_lapacke.h"
41+
#else
3942
#include "src/misc/lapacke.h"
43+
#endif
4044
#include "src/QR/HouseholderQR_LAPACKE.h"
4145
#include "src/QR/ColPivHouseholderQR_LAPACKE.h"
4246
#endif

extern/eigen/Eigen/QtAlignedMalloc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void qFree(void *ptr)
2727
void *qRealloc(void *ptr, std::size_t size)
2828
{
2929
void* newPtr = Eigen::internal::aligned_malloc(size);
30-
memcpy(newPtr, ptr, size);
30+
std::memcpy(newPtr, ptr, size);
3131
Eigen::internal::aligned_free(ptr);
3232
return newPtr;
3333
}

extern/eigen/Eigen/SVD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
#include "src/SVD/JacobiSVD.h"
3838
#include "src/SVD/BDCSVD.h"
3939
#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
40+
#ifdef EIGEN_USE_MKL
41+
#include "mkl_lapacke.h"
42+
#else
4043
#include "src/misc/lapacke.h"
44+
#endif
4145
#include "src/SVD/JacobiSVD_LAPACKE.h"
4246
#endif
4347

extern/eigen/Eigen/src/Cholesky/LDLT.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
248248
/** \brief Reports whether previous computation was successful.
249249
*
250250
* \returns \c Success if computation was succesful,
251-
* \c NumericalIssue if the matrix.appears to be negative.
251+
* \c NumericalIssue if the factorization failed because of a zero pivot.
252252
*/
253253
ComputationInfo info() const
254254
{
@@ -305,7 +305,8 @@ template<> struct ldlt_inplace<Lower>
305305
if (size <= 1)
306306
{
307307
transpositions.setIdentity();
308-
if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
308+
if(size==0) sign = ZeroSign;
309+
else if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
309310
else if (numext::real(mat.coeff(0,0)) < static_cast<RealScalar>(0)) sign = NegativeSemiDef;
310311
else sign = ZeroSign;
311312
return true;
@@ -376,6 +377,8 @@ template<> struct ldlt_inplace<Lower>
376377

377378
if((rs>0) && pivot_is_valid)
378379
A21 /= realAkk;
380+
else if(rs>0)
381+
ret = ret && (A21.array()==Scalar(0)).all();
379382

380383
if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed
381384
else if(!pivot_is_valid) found_zero_pivot = true;
@@ -568,13 +571,14 @@ void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) cons
568571
// more precisely, use pseudo-inverse of D (see bug 241)
569572
using std::abs;
570573
const typename Diagonal<const MatrixType>::RealReturnType vecD(vectorD());
571-
// In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon
572-
// as motivated by LAPACK's xGELSS:
574+
// In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min())
575+
// and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS:
573576
// RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits<RealScalar>::epsilon(),RealScalar(1) / NumTraits<RealScalar>::highest());
574577
// However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest
575578
// diagonal element is not well justified and leads to numerical issues in some cases.
576579
// Moreover, Lapack's xSYTRS routines use 0 for the tolerance.
577-
RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();
580+
// Using numeric_limits::min() gives us more robustness to denormals.
581+
RealScalar tolerance = (std::numeric_limits<RealScalar>::min)();
578582

579583
for (Index i = 0; i < vecD.size(); ++i)
580584
{

0 commit comments

Comments
 (0)