Skip to content

Commit 6c7be6d

Browse files
authored
Update to Eigen 5.0.1 (#150)
* Synchronized with upstream 5.0.1 release (via git tag in 5.0 branch) * Applied (and documented) diff carried over from 5.0.0 * Additional one-line change, added to diff as well * Set release to 0.4.9.9-2 for upstream 5.0.1
1 parent e937884 commit 6c7be6d

34 files changed

Lines changed: 469 additions & 178 deletions

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ debian
1313
^\.github
1414
^\.codecov.yml
1515
^\.covrignore
16+
^local

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2026-06-04 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* inst/include/Eigen/: Sync with upstream Eigen 5.0.1
4+
* inst/include/unsupported/Eigen/: Idem
5+
6+
* inst/include/Eigen/CholmodSupport: Apply previous patch
7+
* inst/include/Eigen/src/CholmodSupport/CholmodSupport.h: Idem
8+
* inst/include/Eigen/src/Core/util/DisableStupidWarnings.h: Idem
9+
* inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h: Idem
10+
* inst/include/Eigen/src/Core/arch/AltiVec/PacketMath.h: New one-line patch
11+
112
2026-05-03 Dirk Eddelbuettel <edd@debian.org>
213

314
* vignettes/rnw/RcppEigen-Introduction.Rnw: Moved, also update three

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: RcppEigen
22
Type: Package
33
Title: 'Rcpp' Integration for the 'Eigen' Templated Linear Algebra Library
4-
Version: 0.4.9.9-1
5-
Date: 2025-12-29
4+
Version: 0.4.9.9-2
5+
Date: 2026-06-04
66
Authors@R: c(person("Doug", "Bates", role = "aut",
77
comment = c(ORCID = "0000-0001-8316-9503")),
88
person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org",

inst/include/Eigen/Core

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106
#include <thread>
107107
#endif
108108

109+
// for __cpp_lib feature test macros
110+
#if defined(__has_include) && __has_include(<version>)
111+
#include <version>
112+
#endif
113+
109114
// for std::bit_cast()
110115
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
111116
#include <bit>

inst/include/Eigen/Version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// As of Eigen3 5.0.0, we have moved to Semantic Versioning (semver.org).
77
#define EIGEN_MAJOR_VERSION 5
88
#define EIGEN_MINOR_VERSION 0
9-
#define EIGEN_PATCH_VERSION 0
9+
#define EIGEN_PATCH_VERSION 1
1010
#define EIGEN_PRERELEASE_VERSION ""
1111
#define EIGEN_BUILD_VERSION ""
12-
#define EIGEN_VERSION_STRING "5.0.0"
12+
#define EIGEN_VERSION_STRING "5.0.1"
1313

1414
#endif // EIGEN_VERSION_H

inst/include/Eigen/src/CholmodSupport/CholmodSupport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ namespace internal {
177177
template <typename StorageIndex_> \
178178
inline ret cm_##name(cholmod_common& Common) { \
179179
return R_MATRIX_CHOLMOD(name)(&Common); \
180-
}
180+
}
181181

182182
#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \
183183
template <typename StorageIndex_> \
184184
inline ret cm_##name(t1& a1, cholmod_common& Common) { \
185185
return R_MATRIX_CHOLMOD(name) (&a1, &Common); \
186-
}
186+
}
187187

188188
EIGEN_CHOLMOD_SPECIALIZE0(int, start)
189189
EIGEN_CHOLMOD_SPECIALIZE0(int, finish)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class vml_assign_traits {
5656
: int(Dst::MaxRowsAtCompileTime),
5757
MaxSizeAtCompileTime = Dst::SizeAtCompileTime,
5858

59-
MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess &&
59+
MightEnableVml = bool(StorageOrdersAgree) && bool(DstHasDirectAccess) && bool(SrcHasDirectAccess) &&
6060
Src::InnerStrideAtCompileTime == 1 && Dst::InnerStrideAtCompileTime == 1,
61-
MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
62-
VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize,
63-
LargeEnough = VmlSize == Dynamic || VmlSize >= EIGEN_MKL_VML_THRESHOLD
61+
MightLinearize = bool(MightEnableVml) && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
62+
VmlSize = bool(MightLinearize) ? MaxSizeAtCompileTime : InnerMaxSize,
63+
LargeEnough = (VmlSize == Dynamic) || VmlSize >= EIGEN_MKL_VML_THRESHOLD
6464
};
6565

6666
public:

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp,
9494
* the returned matrix. Must be compatible with this MatrixBase type.
9595
*
9696
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
97-
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
97+
* it is redundant to pass \a rows and \a cols as arguments, so NullaryExpr(const CustomNullaryOp&) should be used
9898
* instead.
9999
*
100100
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -121,7 +121,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
121121
* \only_for_vectors
122122
*
123123
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
124-
* it is redundant to pass \a size as argument, so Zero() should be used
124+
* it is redundant to pass \a size as argument, so NullaryExpr(const CustomNullaryOp&) should be used
125125
* instead.
126126
*
127127
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -174,7 +174,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
174174
* the returned matrix. Must be compatible with this DenseBase type.
175175
*
176176
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
177-
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
177+
* it is redundant to pass \a rows and \a cols as arguments, so Constant(const Scalar&) should be used
178178
* instead.
179179
*
180180
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -195,7 +195,7 @@ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {
195195
* \only_for_vectors
196196
*
197197
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
198-
* it is redundant to pass \a size as argument, so Zero() should be used
198+
* it is redundant to pass \a size as argument, so Constant(const Scalar&) should be used
199199
* instead.
200200
*
201201
* The template parameter \a CustomNullaryOp is the type of the functor.

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,15 @@ struct plain_array {
6565

6666
template <typename T, int Size, int MatrixOrArrayOptions>
6767
struct plain_array<T, Size, MatrixOrArrayOptions, 0> {
68-
T array[Size];
68+
// on some 32-bit platforms, stack-allocated arrays are aligned to 4 bytes, not the preferred alignment of T
69+
EIGEN_ALIGN_TO_BOUNDARY(alignof(T)) T array[Size];
6970
#if defined(EIGEN_NO_DEBUG) || defined(EIGEN_TESTING_PLAINOBJECT_CTOR)
7071
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
7172
#else
7273
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() { EIGEN_MAKE_STACK_ALLOCATION_ASSERT(Size * sizeof(T)) }
7374
#endif
7475
};
7576

76-
template <typename T, int MatrixOrArrayOptions, int Alignment>
77-
struct plain_array<T, 0, MatrixOrArrayOptions, Alignment> {
78-
T array[1];
79-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
80-
};
81-
8277
template <typename T, int Size, int Options, int Alignment>
8378
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap_plain_array(plain_array<T, Size, Options, Alignment>& a,
8479
plain_array<T, Size, Options, Alignment>& b,

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,15 @@ struct eigen_zero_impl<Xpr, /*use_memset*/ false> {
115115
template <typename Xpr>
116116
struct eigen_zero_impl<Xpr, /*use_memset*/ true> {
117117
using Scalar = typename Xpr::Scalar;
118-
static constexpr size_t max_bytes = (std::numeric_limits<std::ptrdiff_t>::max)();
119118
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst) {
120-
const size_t num_bytes = dst.size() * sizeof(Scalar);
121-
if (num_bytes == 0) return;
119+
const std::ptrdiff_t num_bytes = dst.size() * static_cast<std::ptrdiff_t>(sizeof(Scalar));
120+
if (num_bytes <= 0) return;
122121
void* dst_ptr = static_cast<void*>(dst.data());
123122
#ifndef EIGEN_NO_DEBUG
124-
if (num_bytes > max_bytes) throw_std_bad_alloc();
125123
eigen_assert((dst_ptr != nullptr) && "null pointer dereference error!");
126124
#endif
127125
EIGEN_USING_STD(memset);
128-
memset(dst_ptr, 0, num_bytes);
126+
memset(dst_ptr, 0, static_cast<std::size_t>(num_bytes));
129127
}
130128
template <typename SrcXpr>
131129
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const SrcXpr& src) {

0 commit comments

Comments
 (0)