Skip to content

Commit bcaa34a

Browse files
committed
apply upstream updates on the 3.3 branch
1 parent 2930659 commit bcaa34a

Some content is hidden

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

49 files changed

+676
-511
lines changed

inst/include/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

inst/include/Eigen/Core

Lines changed: 18 additions & 1 deletion
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!
@@ -229,7 +245,7 @@
229245
#if defined __CUDACC__
230246
#define EIGEN_VECTORIZE_CUDA
231247
#include <vector_types.h>
232-
#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500
248+
#if EIGEN_CUDACC_VER >= 70500
233249
#define EIGEN_HAS_CUDA_FP16
234250
#endif
235251
#endif
@@ -352,6 +368,7 @@ using std::ptrdiff_t;
352368
#include "src/Core/MathFunctions.h"
353369
#include "src/Core/GenericPacketMath.h"
354370
#include "src/Core/MathFunctionsImpl.h"
371+
#include "src/Core/arch/Default/ConjHelper.h"
355372

356373
#if defined EIGEN_VECTORIZE_AVX512
357374
#include "src/Core/arch/SSE/PacketMath.h"

inst/include/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"

inst/include/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"

inst/include/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

inst/include/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
}

inst/include/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

inst/include/Eigen/src/Cholesky/LDLT.h

Lines changed: 3 additions & 1 deletion
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
{
@@ -376,6 +376,8 @@ template<> struct ldlt_inplace<Lower>
376376

377377
if((rs>0) && pivot_is_valid)
378378
A21 /= realAkk;
379+
else if(rs>0)
380+
ret = ret && (A21.array()==Scalar(0)).all();
379381

380382
if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed
381383
else if(!pivot_is_valid) found_zero_pivot = true;

inst/include/Eigen/src/Cholesky/LLT.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
2424
*
2525
* \tparam _MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition
2626
* \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper.
27-
* The other triangular part won't be read.
27+
* The other triangular part won't be read.
2828
*
2929
* This class performs a LL^T Cholesky decomposition of a symmetric, positive definite
3030
* matrix A such that A = LL^* = U^*U, where L is lower triangular.
@@ -41,14 +41,18 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
4141
* Example: \include LLT_example.cpp
4242
* Output: \verbinclude LLT_example.out
4343
*
44+
* \b Performance: for best performance, it is recommended to use a column-major storage format
45+
* with the Lower triangular part (the default), or, equivalently, a row-major storage format
46+
* with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization
47+
* step, and rank-updates can be up to 3 times slower.
48+
*
4449
* This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
4550
*
51+
* Note that during the decomposition, only the lower (or upper, as defined by _UpLo) triangular part of A is considered.
52+
* Therefore, the strict lower part does not have to store correct values.
53+
*
4654
* \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT
4755
*/
48-
/* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH)
49-
* Note that during the decomposition, only the upper triangular part of A is considered. Therefore,
50-
* the strict lower part does not have to store correct values.
51-
*/
5256
template<typename _MatrixType, int _UpLo> class LLT
5357
{
5458
public:
@@ -146,7 +150,7 @@ template<typename _MatrixType, int _UpLo> class LLT
146150
}
147151

148152
template<typename Derived>
149-
void solveInPlace(MatrixBase<Derived> &bAndX) const;
153+
void solveInPlace(const MatrixBase<Derived> &bAndX) const;
150154

151155
template<typename InputType>
152156
LLT& compute(const EigenBase<InputType>& matrix);
@@ -177,7 +181,7 @@ template<typename _MatrixType, int _UpLo> class LLT
177181
/** \brief Reports whether previous computation was successful.
178182
*
179183
* \returns \c Success if computation was succesful,
180-
* \c NumericalIssue if the matrix.appears to be negative.
184+
* \c NumericalIssue if the matrix.appears not to be positive definite.
181185
*/
182186
ComputationInfo info() const
183187
{
@@ -425,7 +429,8 @@ LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const EigenBase<InputType>
425429
eigen_assert(a.rows()==a.cols());
426430
const Index size = a.rows();
427431
m_matrix.resize(size, size);
428-
m_matrix = a.derived();
432+
if (!internal::is_same_dense(m_matrix, a.derived()))
433+
m_matrix = a.derived();
429434

430435
// Compute matrix L1 norm = max abs column sum.
431436
m_l1_norm = RealScalar(0);
@@ -485,11 +490,14 @@ void LLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const
485490
*
486491
* This version avoids a copy when the right hand side matrix b is not needed anymore.
487492
*
493+
* \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here.
494+
* This function will const_cast it, so constness isn't honored here.
495+
*
488496
* \sa LLT::solve(), MatrixBase::llt()
489497
*/
490498
template<typename MatrixType, int _UpLo>
491499
template<typename Derived>
492-
void LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
500+
void LLT<MatrixType,_UpLo>::solveInPlace(const MatrixBase<Derived> &bAndX) const
493501
{
494502
eigen_assert(m_isInitialized && "LLT is not initialized.");
495503
eigen_assert(m_matrix.rows()==bAndX.rows());

inst/include/Eigen/src/Core/AssignEvaluator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct copy_using_evaluator_traits
3939
enum {
4040
DstAlignment = DstEvaluator::Alignment,
4141
SrcAlignment = SrcEvaluator::Alignment,
42-
DstHasDirectAccess = DstFlags & DirectAccessBit,
42+
DstHasDirectAccess = (DstFlags & DirectAccessBit) == DirectAccessBit,
4343
JointAlignment = EIGEN_PLAIN_ENUM_MIN(DstAlignment,SrcAlignment)
4444
};
4545

@@ -83,7 +83,7 @@ struct copy_using_evaluator_traits
8383
&& int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0
8484
&& (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)),
8585
MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit),
86-
MayLinearVectorize = bool(MightVectorize) && MayLinearize && DstHasDirectAccess
86+
MayLinearVectorize = bool(MightVectorize) && bool(MayLinearize) && bool(DstHasDirectAccess)
8787
&& (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic),
8888
/* If the destination isn't aligned, we have to do runtime checks and we don't unroll,
8989
so it's only good for large enough sizes. */

0 commit comments

Comments
 (0)