Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ debian
^\.github
^\.codecov.yml
^\.covrignore
^local
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2026-06-04 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Eigen/: Sync with upstream Eigen 5.0.1
* inst/include/unsupported/Eigen/: Idem

* inst/include/Eigen/CholmodSupport: Apply previous patch
* inst/include/Eigen/src/CholmodSupport/CholmodSupport.h: Idem
* inst/include/Eigen/src/Core/util/DisableStupidWarnings.h: Idem
* inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h: Idem
* inst/include/Eigen/src/Core/arch/AltiVec/PacketMath.h: New one-line patch

2026-05-03 Dirk Eddelbuettel <edd@debian.org>

* vignettes/rnw/RcppEigen-Introduction.Rnw: Moved, also update three
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: RcppEigen
Type: Package
Title: 'Rcpp' Integration for the 'Eigen' Templated Linear Algebra Library
Version: 0.4.9.9-1
Date: 2025-12-29
Version: 0.4.9.9-2
Date: 2026-06-04
Authors@R: c(person("Doug", "Bates", role = "aut",
comment = c(ORCID = "0000-0001-8316-9503")),
person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org",
Expand Down
5 changes: 5 additions & 0 deletions inst/include/Eigen/Core
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
#include <thread>
#endif

// for __cpp_lib feature test macros
#if defined(__has_include) && __has_include(<version>)
#include <version>
#endif

// for std::bit_cast()
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
#include <bit>
Expand Down
4 changes: 2 additions & 2 deletions inst/include/Eigen/Version
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// As of Eigen3 5.0.0, we have moved to Semantic Versioning (semver.org).
#define EIGEN_MAJOR_VERSION 5
#define EIGEN_MINOR_VERSION 0
#define EIGEN_PATCH_VERSION 0
#define EIGEN_PATCH_VERSION 1
#define EIGEN_PRERELEASE_VERSION ""
#define EIGEN_BUILD_VERSION ""
#define EIGEN_VERSION_STRING "5.0.0"
#define EIGEN_VERSION_STRING "5.0.1"

#endif // EIGEN_VERSION_H
4 changes: 2 additions & 2 deletions inst/include/Eigen/src/CholmodSupport/CholmodSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ namespace internal {
template <typename StorageIndex_> \
inline ret cm_##name(cholmod_common& Common) { \
return R_MATRIX_CHOLMOD(name)(&Common); \
}
}

#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \
template <typename StorageIndex_> \
inline ret cm_##name(t1& a1, cholmod_common& Common) { \
return R_MATRIX_CHOLMOD(name) (&a1, &Common); \
}
}

EIGEN_CHOLMOD_SPECIALIZE0(int, start)
EIGEN_CHOLMOD_SPECIALIZE0(int, finish)
Expand Down
8 changes: 4 additions & 4 deletions inst/include/Eigen/src/Core/Assign_MKL.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class vml_assign_traits {
: int(Dst::MaxRowsAtCompileTime),
MaxSizeAtCompileTime = Dst::SizeAtCompileTime,

MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess &&
MightEnableVml = bool(StorageOrdersAgree) && bool(DstHasDirectAccess) && bool(SrcHasDirectAccess) &&
Src::InnerStrideAtCompileTime == 1 && Dst::InnerStrideAtCompileTime == 1,
MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize,
LargeEnough = VmlSize == Dynamic || VmlSize >= EIGEN_MKL_VML_THRESHOLD
MightLinearize = bool(MightEnableVml) && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
VmlSize = bool(MightLinearize) ? MaxSizeAtCompileTime : InnerMaxSize,
LargeEnough = (VmlSize == Dynamic) || VmlSize >= EIGEN_MKL_VML_THRESHOLD
};

public:
Expand Down
8 changes: 4 additions & 4 deletions inst/include/Eigen/src/Core/CwiseNullaryOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp,
* the returned matrix. Must be compatible with this MatrixBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
* it is redundant to pass \a rows and \a cols as arguments, so NullaryExpr(const CustomNullaryOp&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
Expand All @@ -121,7 +121,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
* \only_for_vectors
*
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
* it is redundant to pass \a size as argument, so Zero() should be used
* it is redundant to pass \a size as argument, so NullaryExpr(const CustomNullaryOp&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
Expand Down Expand Up @@ -174,7 +174,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
* the returned matrix. Must be compatible with this DenseBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
* it is redundant to pass \a rows and \a cols as arguments, so Constant(const Scalar&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
Expand All @@ -195,7 +195,7 @@ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {
* \only_for_vectors
*
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
* it is redundant to pass \a size as argument, so Zero() should be used
* it is redundant to pass \a size as argument, so Constant(const Scalar&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
Expand Down
9 changes: 2 additions & 7 deletions inst/include/Eigen/src/Core/DenseStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,15 @@ struct plain_array {

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

template <typename T, int MatrixOrArrayOptions, int Alignment>
struct plain_array<T, 0, MatrixOrArrayOptions, Alignment> {
T array[1];
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
};

template <typename T, int Size, int Options, int Alignment>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap_plain_array(plain_array<T, Size, Options, Alignment>& a,
plain_array<T, Size, Options, Alignment>& b,
Expand Down
8 changes: 3 additions & 5 deletions inst/include/Eigen/src/Core/Fill.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,15 @@ struct eigen_zero_impl<Xpr, /*use_memset*/ false> {
template <typename Xpr>
struct eigen_zero_impl<Xpr, /*use_memset*/ true> {
using Scalar = typename Xpr::Scalar;
static constexpr size_t max_bytes = (std::numeric_limits<std::ptrdiff_t>::max)();
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst) {
const size_t num_bytes = dst.size() * sizeof(Scalar);
if (num_bytes == 0) return;
const std::ptrdiff_t num_bytes = dst.size() * static_cast<std::ptrdiff_t>(sizeof(Scalar));
if (num_bytes <= 0) return;
void* dst_ptr = static_cast<void*>(dst.data());
#ifndef EIGEN_NO_DEBUG
if (num_bytes > max_bytes) throw_std_bad_alloc();
eigen_assert((dst_ptr != nullptr) && "null pointer dereference error!");
#endif
EIGEN_USING_STD(memset);
memset(dst_ptr, 0, num_bytes);
memset(dst_ptr, 0, static_cast<std::size_t>(num_bytes));
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const SrcXpr& src) {
Expand Down
8 changes: 7 additions & 1 deletion inst/include/Eigen/src/Core/InnerProduct.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,14 @@ struct scalar_inner_product_op {
static constexpr bool PacketAccess = false;
};

// Partial specialization for packet access if and only if
// LhsScalar == RhsScalar == ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType.
template <typename Scalar, bool Conj>
struct scalar_inner_product_op<Scalar, Scalar, Conj> {
struct scalar_inner_product_op<
Scalar,
typename std::enable_if<internal::is_same<typename ScalarBinaryOpTraits<Scalar, Scalar>::ReturnType, Scalar>::value,
Scalar>::type,
Conj> {
using result_type = Scalar;
using conj_helper = conditional_conj<Scalar, Conj>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(const Scalar& a, const Scalar& b) const {
Expand Down
4 changes: 1 addition & 3 deletions inst/include/Eigen/src/Core/MathFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,7 @@ struct madd_impl {
}
};

// Use FMA if there is a single CPU instruction.
#ifdef EIGEN_VECTORIZE_FMA
#if EIGEN_SCALAR_MADD_USE_FMA
template <typename Scalar>
struct madd_impl<Scalar, std::enable_if_t<has_fma<Scalar>::value>> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Scalar& x, const Scalar& y, const Scalar& z) {
Expand Down Expand Up @@ -1927,7 +1926,6 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar arithmetic_shift_right(const Scalar
return bit_cast<Scalar, SignedScalar>(bit_cast<SignedScalar, Scalar>(a) >> n);
}

// Otherwise, rely on template implementation.
template <typename Scalar>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar fma(const Scalar& x, const Scalar& y, const Scalar& z) {
return internal::fma_impl<Scalar>::run(x, y, z);
Expand Down
3 changes: 3 additions & 0 deletions inst/include/Eigen/src/Core/PermutationMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ class PermutationBase : public EigenBase<Derived> {
*/
DenseMatrixType toDenseMatrix() const { return derived(); }

/** \returns the plain matrix representation of the permutation. */
DenseMatrixType eval() const { return toDenseMatrix(); }

/** const version of indices(). */
const IndicesType& indices() const { return derived().indices(); }
/** \returns a reference to the stored array representing the permutation. */
Expand Down
4 changes: 2 additions & 2 deletions inst/include/Eigen/src/Core/arch/AVX/PacketMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,7 @@ inline __m128i segment_mask_4x8(Index begin, Index count) {
mask <<= CHAR_BIT * count;
mask--;
mask <<= CHAR_BIT * begin;
#if defined(_WIN32) && !defined(_WIN64)
#if !EIGEN_ARCH_x86_64
return _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&mask));
#else
return _mm_cvtsi64_si128(mask);
Expand All @@ -2847,7 +2847,7 @@ inline __m128i segment_mask_8x8(Index begin, Index count) {
mask <<= (CHAR_BIT / 2) * count;
mask--;
mask <<= CHAR_BIT * begin;
#if defined(_WIN32) && !defined(_WIN64)
#if !EIGEN_ARCH_x86_64
return _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&mask));
#else
return _mm_cvtsi64_si128(mask);
Expand Down
4 changes: 2 additions & 2 deletions inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ EIGEN_STRONG_INLINE Packet4d pcast<Packet4l, Packet4d>(const Packet4l& a) {
#if defined(EIGEN_VECTORIZE_AVX512DQ) && defined(EIGEN_VECTORIZE_AVS512VL)
return _mm256_cvtepi64_pd(a);
#else
EIGEN_ALIGN16 int64_t aux[4];
pstore(aux, a);
int64_t aux[4];
pstoreu(aux, a);
return _mm256_set_pd(static_cast<double>(aux[3]), static_cast<double>(aux[2]), static_cast<double>(aux[1]),
static_cast<double>(aux[0]));
#endif
Expand Down
2 changes: 1 addition & 1 deletion inst/include/Eigen/src/Core/arch/AltiVec/PacketMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ EIGEN_ALWAYS_INLINE Packet pload_ignore(const __UNPACK_TYPE__(Packet) * from) {
// Ignore partial input memory initialized
#if !EIGEN_COMP_LLVM
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
//#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#ifdef EIGEN_VECTORIZE_VSX
return vec_xl(0, const_cast<__UNPACK_TYPE__(Packet)*>(from));
Expand Down
46 changes: 23 additions & 23 deletions inst/include/Eigen/src/Core/arch/NEON/Complex.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Packet2cf {
};

template <>
struct packet_traits<std::complex<float> > : default_packet_traits {
struct packet_traits<std::complex<float>> : default_packet_traits {
typedef Packet2cf type;
typedef Packet1cf half;
enum {
Expand Down Expand Up @@ -280,13 +280,13 @@ EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packe

template <>
EIGEN_STRONG_INLINE Packet1cf pload<Packet1cf>(const std::complex<float>* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet1cf>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cf(pload<Packet2f>((const float*)from));
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cf(
pload<Packet2f>(assume_aligned<unpacket_traits<Packet1cf>::alignment>(reinterpret_cast<const float*>(from))));
}
template <>
EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2cf>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>(reinterpret_cast<const float*>(from)));
EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(
pload<Packet4f>(assume_aligned<unpacket_traits<Packet2cf>::alignment>(reinterpret_cast<const float*>(from))));
}

template <>
Expand All @@ -308,22 +308,22 @@ EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* fro
}

template <>
EIGEN_STRONG_INLINE void pstore<std::complex<float> >(std::complex<float>* to, const Packet1cf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet1cf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v);
EIGEN_STRONG_INLINE void pstore<std::complex<float>>(std::complex<float>* to, const Packet1cf& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet1cf>::alignment>(reinterpret_cast<float*>(to)),
from.v);
}
template <>
EIGEN_STRONG_INLINE void pstore<std::complex<float> >(std::complex<float>* to, const Packet2cf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2cf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE pstore(reinterpret_cast<float*>(to), from.v);
EIGEN_STRONG_INLINE void pstore<std::complex<float>>(std::complex<float>* to, const Packet2cf& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet2cf>::alignment>(reinterpret_cast<float*>(to)),
from.v);
}

template <>
EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float>* to, const Packet1cf& from) {
EIGEN_STRONG_INLINE void pstoreu<std::complex<float>>(std::complex<float>* to, const Packet1cf& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v);
}
template <>
EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float>* to, const Packet2cf& from) {
EIGEN_STRONG_INLINE void pstoreu<std::complex<float>>(std::complex<float>* to, const Packet2cf& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<float*>(to), from.v);
}

Expand Down Expand Up @@ -356,7 +356,7 @@ EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::comp
}

template <>
EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float>* addr) {
EIGEN_STRONG_INLINE void prefetch<std::complex<float>>(const std::complex<float>* addr) {
EIGEN_ARM_PREFETCH(reinterpret_cast<const float*>(addr));
}

Expand Down Expand Up @@ -501,7 +501,7 @@ struct Packet1cd {
};

template <>
struct packet_traits<std::complex<double> > : default_packet_traits {
struct packet_traits<std::complex<double>> : default_packet_traits {
typedef Packet1cd type;
typedef Packet1cd half;
enum {
Expand Down Expand Up @@ -531,8 +531,8 @@ struct unpacket_traits<Packet1cd> : neon_unpacket_default<Packet1cd, std::comple

template <>
EIGEN_STRONG_INLINE Packet1cd pload<Packet1cd>(const std::complex<double>* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet1cd>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(pload<Packet2d>(reinterpret_cast<const double*>(from)));
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(
pload<Packet2d>(assume_aligned<unpacket_traits<Packet1cd>::alignment>(reinterpret_cast<const double*>(from))));
}

template <>
Expand Down Expand Up @@ -644,18 +644,18 @@ EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>* fr
}

template <>
EIGEN_STRONG_INLINE void pstore<std::complex<double> >(std::complex<double>* to, const Packet1cd& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet1cd>::alignment);
EIGEN_DEBUG_ALIGNED_STORE pstore(reinterpret_cast<double*>(to), from.v);
EIGEN_STRONG_INLINE void pstore<std::complex<double>>(std::complex<double>* to, const Packet1cd& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet1cd>::alignment>(reinterpret_cast<double*>(to)),
from.v);
}

template <>
EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double>* to, const Packet1cd& from) {
EIGEN_STRONG_INLINE void pstoreu<std::complex<double>>(std::complex<double>* to, const Packet1cd& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), from.v);
}

template <>
EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double>* addr) {
EIGEN_STRONG_INLINE void prefetch<std::complex<double>>(const std::complex<double>* addr) {
EIGEN_ARM_PREFETCH(reinterpret_cast<const double*>(addr));
}

Expand All @@ -677,7 +677,7 @@ EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::com
template <>
EIGEN_STRONG_INLINE std::complex<double> pfirst<Packet1cd>(const Packet1cd& a) {
EIGEN_ALIGN16 std::complex<double> res;
pstore<std::complex<double> >(&res, a);
pstore<std::complex<double>>(&res, a);
return res;
}

Expand Down
Loading