From d5901faee7f5093d0444f28653f9d4c23351803e Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Thu, 9 Oct 2025 18:06:56 -0700 Subject: [PATCH] [upstream_utils] Fix Eigen tag Upstream no longer seems to have the commit we were pointing to. We'll just use the tag since that hasn't changed since the official release announcement. --- upstream_utils/eigen.py | 3 +-- .../thirdparty/eigen/include/Eigen/Version | 4 +-- .../include/Eigen/src/Core/CoreEvaluators.h | 27 +++++++++++++------ .../Eigen/src/Core/ProductEvaluators.h | 8 ++++++ .../Eigen/src/Core/functors/BinaryFunctors.h | 25 +++++------------ .../Eigen/src/SparseCore/SparseMatrixBase.h | 3 --- 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/upstream_utils/eigen.py b/upstream_utils/eigen.py index 222b45e5f21..e3432511601 100755 --- a/upstream_utils/eigen.py +++ b/upstream_utils/eigen.py @@ -145,8 +145,7 @@ def copy_upstream_src(wpilib_root: Path): def main(): name = "eigen" url = "https://gitlab.com/libeigen/eigen.git" - # 5.0.0 release as of 2025-09-23 - tag = "d65cda87c1a673047b59b20a9f9e165a452f91e9" + tag = "5.0.0" eigen = Lib(name, url, tag, copy_upstream_src) eigen.main() diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Version b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Version index db0f3bf2aaf..91936c2e214 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Version +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Version @@ -7,8 +7,8 @@ #define EIGEN_MAJOR_VERSION 5 #define EIGEN_MINOR_VERSION 0 #define EIGEN_PATCH_VERSION 0 -#define EIGEN_PRERELEASE_VERSION -#define EIGEN_BUILD_VERSION +#define EIGEN_PRERELEASE_VERSION "" +#define EIGEN_BUILD_VERSION "" #define EIGEN_VERSION_STRING "5.0.0" #endif // EIGEN_VERSION_H diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/CoreEvaluators.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/CoreEvaluators.h index c9b2d2d2824..60857e2cc41 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/CoreEvaluators.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/CoreEvaluators.h @@ -1048,22 +1048,33 @@ struct ternary_evaluator, IndexBased Data m_d; }; -// specialization for expressions like (a < b).select(c, d) to enable full vectorization template -struct evaluator, Arg1, Arg2, - CwiseBinaryOp, CmpLhsType, CmpRhsType>>> - : public ternary_evaluator< - CwiseTernaryOp, Arg1, Arg2, - CwiseBinaryOp, CmpLhsType, CmpRhsType>>> { +struct scalar_boolean_select_spec { using DummyTernaryOp = scalar_boolean_select_op; using DummyArg3 = CwiseBinaryOp, CmpLhsType, CmpRhsType>; using DummyXprType = CwiseTernaryOp; - using TernaryOp = scalar_boolean_select_op; - using Arg3 = CwiseBinaryOp, CmpLhsType, CmpRhsType>; + // only use the typed comparison if it is vectorized + static constexpr bool UseTyped = functor_traits>::PacketAccess; + using CondScalar = std::conditional_t; + + using TernaryOp = scalar_boolean_select_op; + using Arg3 = CwiseBinaryOp, CmpLhsType, CmpRhsType>; using XprType = CwiseTernaryOp; using Base = ternary_evaluator; +}; + +// specialization for expressions like (a < b).select(c, d) to enable full vectorization +template +struct evaluator, Arg1, Arg2, + CwiseBinaryOp, CmpLhsType, CmpRhsType>>> + : public scalar_boolean_select_spec::Base { + using Helper = scalar_boolean_select_spec; + using Base = typename Helper::Base; + using DummyXprType = typename Helper::DummyXprType; + using Arg3 = typename Helper::Arg3; + using XprType = typename Helper::XprType; EIGEN_DEVICE_FUNC explicit evaluator(const DummyXprType& xpr) : Base(XprType(xpr.arg1(), xpr.arg2(), Arg3(xpr.arg3().lhs(), xpr.arg3().rhs()))) {} diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/ProductEvaluators.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/ProductEvaluators.h index 5955e496f65..be55be5e89f 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/ProductEvaluators.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/ProductEvaluators.h @@ -1272,6 +1272,14 @@ template struct generic_product_impl : generic_product_impl {}; +template +struct generic_product_impl + : generic_product_impl {}; + +template +struct generic_product_impl + : generic_product_impl {}; + } // end namespace internal } // end namespace Eigen diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/functors/BinaryFunctors.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/functors/BinaryFunctors.h index b6ecfb5d55c..85e1584ea8e 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/functors/BinaryFunctors.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/functors/BinaryFunctors.h @@ -207,20 +207,9 @@ struct functor_traits -struct typed_cmp_helper { - static constexpr bool SameType = is_same::value; - static constexpr bool IsNumeric = is_arithmetic::Real>::value; - static constexpr bool UseTyped = UseTypedComparators && SameType && IsNumeric; - using type = typename conditional::type; -}; - -template -using cmp_return_t = typename typed_cmp_helper::type; - template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return a == b ? result_type(1) : result_type(0); } @@ -233,7 +222,7 @@ struct scalar_cmp_op : binary template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return a < b ? result_type(1) : result_type(0); } @@ -246,7 +235,7 @@ struct scalar_cmp_op : binary template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return a <= b ? result_type(1) : result_type(0); } @@ -259,7 +248,7 @@ struct scalar_cmp_op : binary template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return a > b ? result_type(1) : result_type(0); } @@ -272,7 +261,7 @@ struct scalar_cmp_op : binary template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return a >= b ? result_type(1) : result_type(0); } @@ -285,7 +274,7 @@ struct scalar_cmp_op : binary template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return !(a <= b || b <= a) ? result_type(1) : result_type(0); } @@ -298,7 +287,7 @@ struct scalar_cmp_op : bin template struct scalar_cmp_op : binary_op_base { - using result_type = cmp_return_t; + using result_type = std::conditional_t; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const { return a != b ? result_type(1) : result_type(0); } diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/SparseMatrixBase.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/SparseMatrixBase.h index fbf1313d549..ccbbe98da03 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/SparseMatrixBase.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/SparseMatrixBase.h @@ -227,9 +227,6 @@ class SparseMatrixBase : public EigenBase { using Nested = typename Derived::Nested; using NestedCleaned = typename internal::remove_all::type; - /// For converting `0's` to the matrices numerical type - using Scalar = typename Derived::Scalar; - if (Flags & RowMajorBit) { Nested nm(m.derived()); internal::evaluator thisEval(nm);